Revert "don't swallow the first error if the second throws"
This reverts commit 13a4d19764.
This commit is contained in:
parent
13a4d19764
commit
d8d044e5ed
|
|
@ -182,18 +182,15 @@ function createGlobalSetupTask(index: number, length: number): Task<TestRun> {
|
||||||
globalSetupFinished = true;
|
globalSetupFinished = true;
|
||||||
},
|
},
|
||||||
teardown: async ({ config }) => {
|
teardown: async ({ config }) => {
|
||||||
const errors = [];
|
let firstError: any;
|
||||||
if (typeof globalSetupResult === 'function')
|
if (typeof globalSetupResult === 'function')
|
||||||
try { await globalSetupResult(); } catch (error) { errors.push(error); }
|
try { await globalSetupResult(); } catch (error) { firstError = error; }
|
||||||
|
|
||||||
if (globalSetupFinished)
|
if (globalSetupFinished)
|
||||||
try { await teardownHook?.(config.config); } catch (error) { errors.push(error); }
|
await teardownHook?.(config.config);
|
||||||
|
|
||||||
if (errors.length === 1)
|
if (firstError)
|
||||||
throw errors[0];
|
throw firstError;
|
||||||
|
|
||||||
if (errors.length > 1)
|
|
||||||
throw new AggregateError(errors);
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue