[scout] Add Jest events reporter#214662
Conversation
Same as for Playwright, this adds a custom Jest reporter that records and uploads test events.
Prevents issues around transpiling when invoking tests from an IDE.
To serve as an example.
wayneseymour
left a comment
There was a problem hiding this comment.
A question or two, but looks good. Ran it on my machine and I see that it did not upload, as it should not, but did record the results to .scout/reports/scout-jest-075d4121641ca89a/event-log.ndjson
jbudz
left a comment
There was a problem hiding this comment.
The jest-preset changes LGTM.
I'm out of the loop on where we're headed with the testing changes and am probably not the best source to review. I can do a closer look on specifics if needed but need to get up to speed on the background.
This will produce a decent amount of data, may be worth considering a gradual rollout.
💚 Build Succeeded
Metrics [docs]
History
cc @dolaru |
|
Starting backport for target branches: 8.x, 9.0 https://github.com/elastic/kibana/actions/runs/14250021909 |
## Summary Same as for Playwright, this adds a custom Jest reporter that records and uploads test events. ## Quirks ### Config file path Jest is not including the path to the config file used to run the tests in any information passed to the reporter, so this needs to be passed in the `JEST_CONFIG_PATH` environment variable. If Jest is invoked with the `scripts/jest.js` script, the `JEST_CONFIG_PATH` environment variable will be populated with the correct value automatically. ### All the events are produced when the run has completed This is different from the other reporters because the custom reporter interface in Jest is giving the reporter access to necessary info at init or when the run starts. The earliest we can start producing the Scout events is, unfortunately, only after the test run has completed. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Cesare de Cal <cesare.decal@elastic.co> (cherry picked from commit 563c7c3)
## Summary Same as for Playwright, this adds a custom Jest reporter that records and uploads test events. ## Quirks ### Config file path Jest is not including the path to the config file used to run the tests in any information passed to the reporter, so this needs to be passed in the `JEST_CONFIG_PATH` environment variable. If Jest is invoked with the `scripts/jest.js` script, the `JEST_CONFIG_PATH` environment variable will be populated with the correct value automatically. ### All the events are produced when the run has completed This is different from the other reporters because the custom reporter interface in Jest is giving the reporter access to necessary info at init or when the run starts. The earliest we can start producing the Scout events is, unfortunately, only after the test run has completed. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Cesare de Cal <cesare.decal@elastic.co> (cherry picked from commit 563c7c3)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.x`: - [[scout] Add Jest events reporter (#214662)](#214662) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"David Olaru","email":"dolaru@elastic.co"},"sourceCommit":{"committedDate":"2025-04-03T18:20:33Z","message":"[scout] Add Jest events reporter (#214662)\n\n## Summary\n\nSame as for Playwright, this adds a custom Jest reporter that records\nand uploads test events.\n\n## Quirks\n\n### Config file path\nJest is not including the path to the config file used to run the tests\nin any information passed to the reporter, so this needs to be passed in\nthe `JEST_CONFIG_PATH` environment variable. If Jest is invoked with the\n`scripts/jest.js` script, the `JEST_CONFIG_PATH` environment variable\nwill be populated with the correct value automatically.\n\n### All the events are produced when the run has completed\nThis is different from the other reporters because the custom reporter\ninterface in Jest is giving the reporter access to necessary info at\ninit or when the run starts. The earliest we can start producing the\nScout events is, unfortunately, only after the test run has completed.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Cesare de Cal <cesare.decal@elastic.co>","sha":"563c7c3388bcef479a45ea69b45e4236822c8703","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","test:scout","v9.1.0","v8.19.0","v9.0.1"],"title":"[scout] Add Jest events reporter","number":214662,"url":"https://github.com/elastic/kibana/pull/214662","mergeCommit":{"message":"[scout] Add Jest events reporter (#214662)\n\n## Summary\n\nSame as for Playwright, this adds a custom Jest reporter that records\nand uploads test events.\n\n## Quirks\n\n### Config file path\nJest is not including the path to the config file used to run the tests\nin any information passed to the reporter, so this needs to be passed in\nthe `JEST_CONFIG_PATH` environment variable. If Jest is invoked with the\n`scripts/jest.js` script, the `JEST_CONFIG_PATH` environment variable\nwill be populated with the correct value automatically.\n\n### All the events are produced when the run has completed\nThis is different from the other reporters because the custom reporter\ninterface in Jest is giving the reporter access to necessary info at\ninit or when the run starts. The earliest we can start producing the\nScout events is, unfortunately, only after the test run has completed.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Cesare de Cal <cesare.decal@elastic.co>","sha":"563c7c3388bcef479a45ea69b45e4236822c8703"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/214662","number":214662,"mergeCommit":{"message":"[scout] Add Jest events reporter (#214662)\n\n## Summary\n\nSame as for Playwright, this adds a custom Jest reporter that records\nand uploads test events.\n\n## Quirks\n\n### Config file path\nJest is not including the path to the config file used to run the tests\nin any information passed to the reporter, so this needs to be passed in\nthe `JEST_CONFIG_PATH` environment variable. If Jest is invoked with the\n`scripts/jest.js` script, the `JEST_CONFIG_PATH` environment variable\nwill be populated with the correct value automatically.\n\n### All the events are produced when the run has completed\nThis is different from the other reporters because the custom reporter\ninterface in Jest is giving the reporter access to necessary info at\ninit or when the run starts. The earliest we can start producing the\nScout events is, unfortunately, only after the test run has completed.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Cesare de Cal <cesare.decal@elastic.co>","sha":"563c7c3388bcef479a45ea69b45e4236822c8703"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: David Olaru <dolaru@elastic.co>
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
# Backport This will backport the following commits from `main` to `9.0`: - [[scout] Add Jest events reporter (#214662)](#214662) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"David Olaru","email":"dolaru@elastic.co"},"sourceCommit":{"committedDate":"2025-04-03T18:20:33Z","message":"[scout] Add Jest events reporter (#214662)\n\n## Summary\n\nSame as for Playwright, this adds a custom Jest reporter that records\nand uploads test events.\n\n## Quirks\n\n### Config file path\nJest is not including the path to the config file used to run the tests\nin any information passed to the reporter, so this needs to be passed in\nthe `JEST_CONFIG_PATH` environment variable. If Jest is invoked with the\n`scripts/jest.js` script, the `JEST_CONFIG_PATH` environment variable\nwill be populated with the correct value automatically.\n\n### All the events are produced when the run has completed\nThis is different from the other reporters because the custom reporter\ninterface in Jest is giving the reporter access to necessary info at\ninit or when the run starts. The earliest we can start producing the\nScout events is, unfortunately, only after the test run has completed.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Cesare de Cal <cesare.decal@elastic.co>","sha":"563c7c3388bcef479a45ea69b45e4236822c8703","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","test:scout","v9.1.0","v8.19.0","v9.0.1"],"title":"[scout] Add Jest events reporter","number":214662,"url":"https://github.com/elastic/kibana/pull/214662","mergeCommit":{"message":"[scout] Add Jest events reporter (#214662)\n\n## Summary\n\nSame as for Playwright, this adds a custom Jest reporter that records\nand uploads test events.\n\n## Quirks\n\n### Config file path\nJest is not including the path to the config file used to run the tests\nin any information passed to the reporter, so this needs to be passed in\nthe `JEST_CONFIG_PATH` environment variable. If Jest is invoked with the\n`scripts/jest.js` script, the `JEST_CONFIG_PATH` environment variable\nwill be populated with the correct value automatically.\n\n### All the events are produced when the run has completed\nThis is different from the other reporters because the custom reporter\ninterface in Jest is giving the reporter access to necessary info at\ninit or when the run starts. The earliest we can start producing the\nScout events is, unfortunately, only after the test run has completed.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Cesare de Cal <cesare.decal@elastic.co>","sha":"563c7c3388bcef479a45ea69b45e4236822c8703"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/214662","number":214662,"mergeCommit":{"message":"[scout] Add Jest events reporter (#214662)\n\n## Summary\n\nSame as for Playwright, this adds a custom Jest reporter that records\nand uploads test events.\n\n## Quirks\n\n### Config file path\nJest is not including the path to the config file used to run the tests\nin any information passed to the reporter, so this needs to be passed in\nthe `JEST_CONFIG_PATH` environment variable. If Jest is invoked with the\n`scripts/jest.js` script, the `JEST_CONFIG_PATH` environment variable\nwill be populated with the correct value automatically.\n\n### All the events are produced when the run has completed\nThis is different from the other reporters because the custom reporter\ninterface in Jest is giving the reporter access to necessary info at\ninit or when the run starts. The earliest we can start producing the\nScout events is, unfortunately, only after the test run has completed.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Cesare de Cal <cesare.decal@elastic.co>","sha":"563c7c3388bcef479a45ea69b45e4236822c8703"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: David Olaru <dolaru@elastic.co>

Summary
Same as for Playwright, this adds a custom Jest reporter that records and uploads test events.
Quirks
Config file path
Jest is not including the path to the config file used to run the tests in any information passed to the reporter, so this needs to be passed in the
JEST_CONFIG_PATHenvironment variable. If Jest is invoked with thescripts/jest.jsscript, theJEST_CONFIG_PATHenvironment variable will be populated with the correct value automatically.All the events are produced when the run has completed
This is different from the other reporters because the custom reporter interface in Jest is giving the reporter access to necessary info at init or when the run starts. The earliest we can start producing the Scout events is, unfortunately, only after the test run has completed.