revert ordering
This commit is contained in:
parent
3ef8178cca
commit
d1273ad1b6
|
|
@ -182,10 +182,10 @@ function createGlobalSetupTask(index: number, length: number): Task<TestRun> {
|
|||
globalSetupFinished = true;
|
||||
},
|
||||
teardown: async ({ config }) => {
|
||||
if (globalSetupFinished)
|
||||
await teardownHook?.(config.config);
|
||||
if (typeof globalSetupResult === 'function')
|
||||
await globalSetupResult();
|
||||
if (globalSetupFinished)
|
||||
await teardownHook?.(config.config);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -392,15 +392,15 @@ test('globalSetup should support multiple', async ({ runInlineTest }) => {
|
|||
'playwright.config.ts': `
|
||||
module.exports = {
|
||||
globalSetup: ['./globalSetup1.ts','./globalSetup2.ts','./globalSetup3.ts','./globalSetup4.ts'],
|
||||
globalTeardown: ['./globalTeardown2.ts', './globalTeardown3.ts'],
|
||||
globalTeardown: ['./globalTeardown1.ts', './globalTeardown2.ts'],
|
||||
};
|
||||
`,
|
||||
'globalSetup1.ts': `module.exports = () => { console.log('%%globalSetup1'); return () => console.log('%%globalSetup1Function'); };`,
|
||||
'globalSetup1.ts': `module.exports = () => { console.log('%%globalSetup1'); return () => { console.log('%%globalSetup1Function'); throw new Error('kaboom'); } };`,
|
||||
'globalSetup2.ts': `module.exports = () => console.log('%%globalSetup2');`,
|
||||
'globalSetup3.ts': `module.exports = () => { console.log('%%globalSetup3'); return () => console.log('%%globalSetup3Function'); }`,
|
||||
'globalSetup4.ts': `module.exports = () => console.log('%%globalSetup4');`,
|
||||
'globalTeardown2.ts': `module.exports = () => { console.log('%%globalTeardown2'); throw new Error('kaboom'); }`,
|
||||
'globalTeardown3.ts': `module.exports = () => console.log('%%globalTeardown3');`,
|
||||
'globalTeardown1.ts': `module.exports = () => console.log('%%globalTeardown1')`,
|
||||
'globalTeardown2.ts': `module.exports = () => console.log('%%globalTeardown2');`,
|
||||
|
||||
'a.test.js': `
|
||||
import { test } from '@playwright/test';
|
||||
|
|
@ -420,9 +420,9 @@ test('globalSetup should support multiple', async ({ runInlineTest }) => {
|
|||
'test a',
|
||||
'test b',
|
||||
'globalSetup3Function',
|
||||
'globalTeardown3',
|
||||
'globalTeardown2',
|
||||
// 'globalSetup1Function' is missing, because globalTeardown2 errored out.
|
||||
'globalSetup1Function',
|
||||
// 'globalTeardown1' is missing, because globalTeardown1 errored out.
|
||||
]);
|
||||
expect(result.output).toContain('Error: kaboom');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue