make behaviour congruent for globalTeardown
This commit is contained in:
parent
a72ec6e824
commit
9b785662f6
|
|
@ -182,10 +182,15 @@ function createGlobalSetupTask(index: number, length: number): Task<TestRun> {
|
|||
globalSetupFinished = true;
|
||||
},
|
||||
teardown: async ({ config }) => {
|
||||
let firstError: any;
|
||||
if (typeof globalSetupResult === 'function')
|
||||
await globalSetupResult();
|
||||
try { await globalSetupResult(); } catch (error) { firstError = error; }
|
||||
|
||||
if (globalSetupFinished)
|
||||
await teardownHook?.(config.config);
|
||||
|
||||
if (firstError)
|
||||
throw firstError;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -422,7 +422,7 @@ test('globalSetup should support multiple', async ({ runInlineTest }) => {
|
|||
'globalSetup3Function',
|
||||
'globalTeardown2',
|
||||
'globalSetup1Function',
|
||||
// 'globalTeardown1' is missing, because globalSetup1Function errored out.
|
||||
'globalTeardown1',
|
||||
]);
|
||||
expect(result.output).toContain('Error: kaboom');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue