Skip to content

feat: add jest 27 support#5

Merged
ryansolid merged 1 commit intosolidjs:mainfrom
StalkAltan:feat/jest-27-support
Aug 9, 2021
Merged

feat: add jest 27 support#5
ryansolid merged 1 commit intosolidjs:mainfrom
StalkAltan:feat/jest-27-support

Conversation

@StalkAltan
Copy link

@StalkAltan StalkAltan commented Aug 9, 2021

This PR adds support for jest 27. There are some slight changes that required tweaks.

The goal of this is to 1) keep these presets up to date, and 2) support using Jest/Solid within Nx workspaces.

I've added comments to the various changes with rationale. I didn't bump the package version in the package.json because I don't know how the team would like this to move.

Once this package supports Jest 27, all that is needed for solid-testing-library to also support that version is bumping the package.json :)

Comment on lines +7 to +11
{
"targets": {
"node": "current"
}
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resolves an issue where running Jest results in ReferenceError: regeneratorRuntime is not defined.

...shared,
// uses a webpack style resolver, the default one has many issues.
resolver: require.resolve("./resolver"),
testEnvironment: 'jsdom',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Jest 27, jsdom is no longer the default test environment, so we need to specify it here.

const babelJest = require("babel-jest");

module.exports = babelJest.createTransformer({
module.exports = babelJest.default.createTransformer({
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In babel-jest 27, createTransformer is now exposed via a default export.

@ryansolid
Copy link
Member

This all looks great thank you.

@ryansolid ryansolid merged commit 3641844 into solidjs:main Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants