-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Jest reporters for CI (#11125)
Switches to jest summary reporter with a zero threshold so we can see what test failed on CI. ### Before ![image](https://github.com/user-attachments/assets/1ce397ee-34df-46a7-9450-2db8dd0e843f) ### After ![Screenshot from 2025-01-09 11-55-46](https://github.com/user-attachments/assets/a40c754c-403a-4be8-9848-c02f086aa2f6)
- Loading branch information
1 parent
1b88a34
commit 90cd9d2
Showing
6 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const { cwd } = require('process'); | ||
const { join } = require('path'); | ||
const { readFileSync } = require('fs'); | ||
|
||
// Loads the jest config from the package.json in the working directory and overrides the reporters. | ||
// Note we cannot just use the `--reporters` CLI option because it does not allow setting options, | ||
// and we need the `summaryThreshold` option to show actual errors when tests fail. | ||
// This file is only used from the yarn project root `test` script. | ||
/** @type {import('jest').Config} */ | ||
const config = { | ||
...JSON.parse(readFileSync(join(cwd(), 'package.json'), 'utf-8')).jest, | ||
// CI-friendly reporters config | ||
reporters: [ | ||
['github-actions', { silent: false }], | ||
['summary', { summaryThreshold: 0 }], | ||
], | ||
// Override rootDir to the src of the current package | ||
rootDir: join(cwd(), 'src'), | ||
}; | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"scripts": { | ||
"test": "yarn test:node && yarn test:browser" | ||
"test": "yarn test:node && yarn test:browser && true" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters