From e124d926ee69596b4514ebcc12895f00c3b60d03 Mon Sep 17 00:00:00 2001 From: Ross Wollman Date: Thu, 28 Apr 2022 11:22:09 -0700 Subject: [PATCH] test: log more phases of plugins (#13825) --- tests/playwright-test/plugins.spec.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/playwright-test/plugins.spec.ts b/tests/playwright-test/plugins.spec.ts index 90a28ec526..92a8c6488b 100644 --- a/tests/playwright-test/plugins.spec.ts +++ b/tests/playwright-test/plugins.spec.ts @@ -48,13 +48,18 @@ test('event order', async ({ runInlineTest }, testInfo) => { export default setup; `, 'globalTeardown.ts': ` + import log from './log'; const teardown = () => log('globalTeardown'); export default teardown; `, 'plugin.ts': ` import log from './log'; export const myPlugin = (name: string) => ({ - configure: async (config) => { config.use = (config.use || {}); config.use.baseURL = (config.use.baseURL || '') + name + ' | '; }, + configure: async (config) => { + log(name, 'configure'); + config.use = (config.use || {}); + config.use.baseURL = (config.use.baseURL || '') + name + ' | '; + }, setup: async () => log(name, 'setup'), teardown: async () => log(name, 'teardown'), }); @@ -64,10 +69,15 @@ test('event order', async ({ runInlineTest }, testInfo) => { expect(result.passed).toBe(1); const logLines = await fs.promises.readFile(log, 'utf8'); expect(logLines.split('\n')).toEqual([ + 'a configure', + 'b configure', 'a setup', 'b setup', 'globalSetup', + 'a configure', + 'b configure', 'baseURL a | b | ', + 'globalTeardown', 'b teardown', 'a teardown', '',