Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use jest-circus in unit tests #31178

Merged
merged 1 commit into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Include a Jest Reporter that formats test results for GitHub Actions annotations ([#31041](https://github.com/WordPress/gutenberg/pull/31041)).
- Have the `format` command ignore files listed in a `.prettierignore` file, add a fallback `.prettierignore` to the package ([30844](https://github.com/WordPress/gutenberg/pull/30844)).
- The e2e tests are now using [`jest-circus`](https://github.com/facebook/jest/tree/master/packages/jest-circus) as the test runner. This enable us to capture screenshots at the time the tests failed. The unit tests are also using the same test runner for consistency ([#28449](https://github.com/WordPress/gutenberg/pull/28449), [#31178](https://github.com/WordPress/gutenberg/pull/31178)).

### Breaking Changes

Expand Down
4 changes: 2 additions & 2 deletions packages/scripts/config/jest-environment-puppeteer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ class PuppeteerEnvironment extends NodeEnvironment {
replacement: '-',
} );
await writeFile(
`${ ARTIFACTS_PATH }/${ fileName }-snapshot.html`,
path.join( ARTIFACTS_PATH, `${ fileName }-snapshot.html` ),
await this.global.page.content()
);
await this.global.page.screenshot( {
path: `${ ARTIFACTS_PATH }/${ fileName }.jpg`,
path: path.join( ARTIFACTS_PATH, `${ fileName }.jpg` ),
} );
}

Expand Down
1 change: 1 addition & 0 deletions packages/scripts/config/jest-unit.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const path = require( 'path' );
const { hasBabelConfig } = require( '../utils' );

const jestUnitConfig = {
testRunner: 'jest-circus/runner',
preset: '@wordpress/jest-preset-default',
reporters: [
'default',
Expand Down