diff --git a/docs/src/test-reporters.md b/docs/src/test-reporters.md index 5c1f642040082..4465e5854fdb6 100644 --- a/docs/src/test-reporters.md +++ b/docs/src/test-reporters.md @@ -39,10 +39,12 @@ You can use different reporters locally and on CI. // playwright.config.js module.exports = { reporter: !process.env.CI - // A list of tests for the terminal + // Default 'list' reporter for the terminal ? 'list' - // Very concise "dot" reporter and a comprehensive json report for CI - : ['dot', { name: 'json', outputFile: 'test-results.json' }], + // Two reporters for CI: + // - concise "dot" + // - comprehensive json report + : [ ['dot'], [ 'json', { outputFile: 'test-results.json' }] ], }; ``` @@ -51,11 +53,12 @@ module.exports = { import { PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { - reporter: !process.env.CI - // A list of tests for the terminal + // Default 'list' reporter for the terminal ? 'list' - // Very concise "dot" reporter and a comprehensive json report for CI - : ['dot', { name: 'json', outputFile: 'test-results.json' }], + // Two reporters for CI: + // - concise "dot" + // - comprehensive json report + : [ ['dot'], [ 'json', { outputFile: 'test-results.json' }] ], }; export default config; ``` @@ -190,7 +193,7 @@ In configuration file, pass options directly: ```js js-flavor=js // playwright.config.js module.exports = { - reporter: { name: 'json', outputFile: 'results.json' }, + reporter: [ ['json', { outputFile: 'results.json' }] ], }; ``` @@ -199,7 +202,7 @@ module.exports = { import { PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { - reporter: { name: 'json', outputFile: 'results.json' }, + reporter: [ ['json', { outputFile: 'results.json' }] ], }; export default config; ``` @@ -217,7 +220,7 @@ In configuration file, pass options directly: ```js js-flavor=js // playwright.config.js module.exports = { - reporter: { name: 'junit', outputFile: 'results.xml' }, + reporter: [ ['junit', { outputFile: 'results.xml' }] ], }; ``` @@ -226,7 +229,7 @@ module.exports = { import { PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { - reporter: { name: 'junit', outputFile: 'results.xml' }, + reporter: [ ['junit', { outputFile: 'results.xml' }] ], }; export default config; ``` diff --git a/package-lock.json b/package-lock.json index 5d95a286ce01f..d33b2dd322e22 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "eslint-plugin-notice": "^0.9.10", "eslint-plugin-react-hooks": "^4.2.0", "file-loader": "^6.1.0", - "folio": "=0.4.0-alpha26", + "folio": "=0.4.0-alpha27", "formidable": "^1.2.2", "html-webpack-plugin": "^4.4.1", "ncp": "^2.0.0", @@ -4199,9 +4199,9 @@ } }, "node_modules/folio": { - "version": "0.4.0-alpha26", - "resolved": "https://registry.npmjs.org/folio/-/folio-0.4.0-alpha26.tgz", - "integrity": "sha512-OTBrLhzv2iZbaawCiQ9tMnHB41TdORiTd9IsRtuDHljhcgQUlvNEemVoliYuZeiyPbWuxRuzHuO10sKnnx23CA==", + "version": "0.4.0-alpha27", + "resolved": "https://registry.npmjs.org/folio/-/folio-0.4.0-alpha27.tgz", + "integrity": "sha512-IjCe0ds6N++F2rVKGHm8lXLqH4smGiwZMP5tylFR7PQykU+i9eGKka1TtxXxhReAH9DMEb3+YRWfzZZdF43MXg==", "dev": true, "dependencies": { "@babel/code-frame": "^7.12.13", @@ -13205,9 +13205,9 @@ } }, "folio": { - "version": "0.4.0-alpha26", - "resolved": "https://registry.npmjs.org/folio/-/folio-0.4.0-alpha26.tgz", - "integrity": "sha512-OTBrLhzv2iZbaawCiQ9tMnHB41TdORiTd9IsRtuDHljhcgQUlvNEemVoliYuZeiyPbWuxRuzHuO10sKnnx23CA==", + "version": "0.4.0-alpha27", + "resolved": "https://registry.npmjs.org/folio/-/folio-0.4.0-alpha27.tgz", + "integrity": "sha512-IjCe0ds6N++F2rVKGHm8lXLqH4smGiwZMP5tylFR7PQykU+i9eGKka1TtxXxhReAH9DMEb3+YRWfzZZdF43MXg==", "dev": true, "requires": { "@babel/code-frame": "^7.12.13", diff --git a/package.json b/package.json index e618041070a79..df8f46bfb007b 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "eslint-plugin-notice": "^0.9.10", "eslint-plugin-react-hooks": "^4.2.0", "file-loader": "^6.1.0", - "folio": "=0.4.0-alpha26", + "folio": "=0.4.0-alpha27", "formidable": "^1.2.2", "html-webpack-plugin": "^4.4.1", "ncp": "^2.0.0", diff --git a/src/cli/testRunner.ts b/src/cli/testRunner.ts index 7836830c721ac..484dfbdb34e3d 100644 --- a/src/cli/testRunner.ts +++ b/src/cli/testRunner.ts @@ -30,7 +30,7 @@ const tsConfig = 'playwright.config.ts'; const jsConfig = 'playwright.config.js'; const defaultConfig: Config = { preserveOutput: process.env.CI ? 'failures-only' : 'always', - reporter: [defaultReporter], + reporter: [ [defaultReporter] ], timeout: defaultTimeout, updateSnapshots: process.env.CI ? 'none' : 'missing', workers: Math.ceil(require('os').cpus().length / 2), @@ -167,9 +167,7 @@ function overridesFromOptions(options: { [key: string]: any }): Config { quiet: options.quiet ? options.quiet : undefined, repeatEach: options.repeatEach ? parseInt(options.repeatEach, 10) : undefined, retries: options.retries ? parseInt(options.retries, 10) : undefined, - reporter: (options.reporter && options.reporter.length) ? options.reporter.split(',').map((r: string) => { - return builtinReporters.includes(r) ? r : { require: r }; - }) : undefined, + reporter: (options.reporter && options.reporter.length) ? options.reporter.split(',').map((r: string) => [r]) : undefined, shard: shardPair ? { current: shardPair[0] - 1, total: shardPair[1] } : undefined, timeout: isDebuggerAttached ? 0 : (options.timeout ? parseInt(options.timeout, 10) : undefined), updateSnapshots: options.updateSnapshots ? 'all' as const : undefined, diff --git a/tests/config/android.config.ts b/tests/config/android.config.ts index 4375dc24c8232..0eafb6979e482 100644 --- a/tests/config/android.config.ts +++ b/tests/config/android.config.ts @@ -32,8 +32,8 @@ const config: folio.Config = { forbidOnly: !!process.env.CI, retries: process.env.CI ? 1 : 0, reporter: process.env.CI ? [ - 'dot', - { name: 'json', outputFile: path.join(outputDir, 'report.json') }, + [ 'dot' ], + [ 'json', { outputFile: path.join(outputDir, 'report.json') } ], ] : 'line', projects: [], }; diff --git a/tests/config/default.config.ts b/tests/config/default.config.ts index d50fa64c08d00..6b0d21b05ba36 100644 --- a/tests/config/default.config.ts +++ b/tests/config/default.config.ts @@ -54,8 +54,8 @@ const config: folio.Config = { forbidOnly: !!process.env.CI, retries: process.env.CI ? 3 : 0, reporter: process.env.CI ? [ - 'dot', - { name: 'json', outputFile: path.join(outputDir, 'report.json') }, + [ 'dot' ], + [ 'json', { outputFile: path.join(outputDir, 'report.json') } ], ] : 'line', projects: [], }; diff --git a/tests/config/electron.config.ts b/tests/config/electron.config.ts index 2ae639f69ecab..61344ccb6d34b 100644 --- a/tests/config/electron.config.ts +++ b/tests/config/electron.config.ts @@ -32,8 +32,8 @@ const config: folio.Config = { forbidOnly: !!process.env.CI, retries: process.env.CI ? 3 : 0, reporter: process.env.CI ? [ - 'dot', - { name: 'json', outputFile: path.join(outputDir, 'report.json') }, + [ 'dot' ], + [ 'json', { outputFile: path.join(outputDir, 'report.json') } ], ] : 'line', projects: [], };