[8.x] [scout] disable reporter for config validation command (#212072) (#212108)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[scout] disable reporter for config validation command
(#212072)](https://github.com/elastic/kibana/pull/212072)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2025-02-21T15:42:32Z","message":"[scout]
disable reporter for config validation command (#212072)\n\n##
Summary\n\nIn #211918 I added config validation check to skip run if
there are no\ntests in playwright config.\n\nIt turned out that
Playwright init reporters even when `--list` command\nis passed and no
tests are executed, that lead to Scout reports being\nloaded and then
causing reporter error when the other command runs the\ntests:\n\n```\n
proc [playwright] info Calling save with destination:
/Users/dmle/github/kibana/.scout/reports/scout-playwright-9518363d47816953\n
proc [playwright] ERROR Error: Save destination path
'/Users/dmle/github/kibana/.scout/reports/scout-playwright-9518363d47816953'
already exists\n proc [playwright] at ScoutEventsReport.save
(/Users/dmle/github/kibana/packages/kbn-scout-reporting/src/reporting/report/events/report.ts:56:13)\n
proc [playwright] at ScoutPlaywrightReporter.onEnd
(/Users/dmle/github/kibana/packages/kbn-scout-reporting/src/reporting/playwright/events/playwright_reporter.ts:277:19)\n
proc [playwright] at ReporterV2Wrapper.onEnd
(/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/reporterV2.js:91:165)\n
proc [playwright] at
/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/multiplexer.js:71:117\n
proc [playwright] at wrapAsync
(/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/multiplexer.js:112:18)\n
proc [playwright] at Multiplexer.onEnd
(/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/multiplexer.js:69:31)\n
proc [playwright] at InternalReporter.onEnd
(/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/internalReporter.js:77:12)\n
proc [playwright] at finishTaskRun
(/Users/dmle/github/kibana/node_modules/playwright/lib/runner/tasks.js:90:26)\n
proc [playwright] at runTasks
(/Users/dmle/github/kibana/node_modules/playwright/lib/runner/tasks.js:73:10)\n
proc [playwright] at Runner.runAllTests
(/Users/dmle/github/kibana/node_modules/playwright/lib/runner/runner.js:72:20)\n
proc [playwright] at runTests
(/Users/dmle/github/kibana/node_modules/playwright/lib/program.js:211:18)\n
proc [playwright] at t.<anonymous>
(/Users/dmle/github/kibana/node_modules/playwright/lib/program.js:54:7)\n```\n\nThe
simplest solution is to explicitly disable Scout reporter for
config\nvalidation
command.","sha":"f5a1ead8cf053168cd94fdc45facaca8f2dbc35a","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:QA","release_note:skip","v9.0.0","backport:version","test:scout","v9.1.0","v8.19.0"],"title":"[scout]
disable reporter for config validation
command","number":212072,"url":"https://github.com/elastic/kibana/pull/212072","mergeCommit":{"message":"[scout]
disable reporter for config validation command (#212072)\n\n##
Summary\n\nIn #211918 I added config validation check to skip run if
there are no\ntests in playwright config.\n\nIt turned out that
Playwright init reporters even when `--list` command\nis passed and no
tests are executed, that lead to Scout reports being\nloaded and then
causing reporter error when the other command runs the\ntests:\n\n```\n
proc [playwright] info Calling save with destination:
/Users/dmle/github/kibana/.scout/reports/scout-playwright-9518363d47816953\n
proc [playwright] ERROR Error: Save destination path
'/Users/dmle/github/kibana/.scout/reports/scout-playwright-9518363d47816953'
already exists\n proc [playwright] at ScoutEventsReport.save
(/Users/dmle/github/kibana/packages/kbn-scout-reporting/src/reporting/report/events/report.ts:56:13)\n
proc [playwright] at ScoutPlaywrightReporter.onEnd
(/Users/dmle/github/kibana/packages/kbn-scout-reporting/src/reporting/playwright/events/playwright_reporter.ts:277:19)\n
proc [playwright] at ReporterV2Wrapper.onEnd
(/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/reporterV2.js:91:165)\n
proc [playwright] at
/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/multiplexer.js:71:117\n
proc [playwright] at wrapAsync
(/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/multiplexer.js:112:18)\n
proc [playwright] at Multiplexer.onEnd
(/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/multiplexer.js:69:31)\n
proc [playwright] at InternalReporter.onEnd
(/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/internalReporter.js:77:12)\n
proc [playwright] at finishTaskRun
(/Users/dmle/github/kibana/node_modules/playwright/lib/runner/tasks.js:90:26)\n
proc [playwright] at runTasks
(/Users/dmle/github/kibana/node_modules/playwright/lib/runner/tasks.js:73:10)\n
proc [playwright] at Runner.runAllTests
(/Users/dmle/github/kibana/node_modules/playwright/lib/runner/runner.js:72:20)\n
proc [playwright] at runTests
(/Users/dmle/github/kibana/node_modules/playwright/lib/program.js:211:18)\n
proc [playwright] at t.<anonymous>
(/Users/dmle/github/kibana/node_modules/playwright/lib/program.js:54:7)\n```\n\nThe
simplest solution is to explicitly disable Scout reporter for
config\nvalidation
command.","sha":"f5a1ead8cf053168cd94fdc45facaca8f2dbc35a"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/212072","number":212072,"mergeCommit":{"message":"[scout]
disable reporter for config validation command (#212072)\n\n##
Summary\n\nIn #211918 I added config validation check to skip run if
there are no\ntests in playwright config.\n\nIt turned out that
Playwright init reporters even when `--list` command\nis passed and no
tests are executed, that lead to Scout reports being\nloaded and then
causing reporter error when the other command runs the\ntests:\n\n```\n
proc [playwright] info Calling save with destination:
/Users/dmle/github/kibana/.scout/reports/scout-playwright-9518363d47816953\n
proc [playwright] ERROR Error: Save destination path
'/Users/dmle/github/kibana/.scout/reports/scout-playwright-9518363d47816953'
already exists\n proc [playwright] at ScoutEventsReport.save
(/Users/dmle/github/kibana/packages/kbn-scout-reporting/src/reporting/report/events/report.ts:56:13)\n
proc [playwright] at ScoutPlaywrightReporter.onEnd
(/Users/dmle/github/kibana/packages/kbn-scout-reporting/src/reporting/playwright/events/playwright_reporter.ts:277:19)\n
proc [playwright] at ReporterV2Wrapper.onEnd
(/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/reporterV2.js:91:165)\n
proc [playwright] at
/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/multiplexer.js:71:117\n
proc [playwright] at wrapAsync
(/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/multiplexer.js:112:18)\n
proc [playwright] at Multiplexer.onEnd
(/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/multiplexer.js:69:31)\n
proc [playwright] at InternalReporter.onEnd
(/Users/dmle/github/kibana/node_modules/playwright/lib/reporters/internalReporter.js:77:12)\n
proc [playwright] at finishTaskRun
(/Users/dmle/github/kibana/node_modules/playwright/lib/runner/tasks.js:90:26)\n
proc [playwright] at runTasks
(/Users/dmle/github/kibana/node_modules/playwright/lib/runner/tasks.js:73:10)\n
proc [playwright] at Runner.runAllTests
(/Users/dmle/github/kibana/node_modules/playwright/lib/runner/runner.js:72:20)\n
proc [playwright] at runTests
(/Users/dmle/github/kibana/node_modules/playwright/lib/program.js:211:18)\n
proc [playwright] at t.<anonymous>
(/Users/dmle/github/kibana/node_modules/playwright/lib/program.js:54:7)\n```\n\nThe
simplest solution is to explicitly disable Scout reporter for
config\nvalidation
command.","sha":"f5a1ead8cf053168cd94fdc45facaca8f2dbc35a"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
This commit is contained in:
Kibana Machine 2025-02-22 05:03:54 +11:00 committed by GitHub
parent fe907479be
commit c6da5a53a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,7 +38,10 @@ export async function runTests(log: ToolingLog, options: RunTestsOptions) {
log.info(`scout: Validate Playwright config has tests`);
try {
// '--list' flag tells Playwright to collect all the tests, but do not run it
const result = await execPromise(`${cmd} ${cmdArgs.join(' ')} --list`);
// We disable scout reporter explicitly to avoid creating directories and collecting stats
const result = await execPromise(
`SCOUT_REPORTER_ENABLED=false ${cmd} ${cmdArgs.join(' ')} --list`
);
const lastLine = result.stdout.trim().split('\n').pop();
log.info(`scout: ${lastLine}`);
} catch (err) {