-
Notifications
You must be signed in to change notification settings - Fork 918
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
[BUG] @snowpack/app-scripts-react is not compatible with Jest 27. #3398
Comments
This is the correct fix, |
|
Looks like Snowpack should be very interested in v27 as it claims "experimental support" for ES modules. Has anyone tried to upgrade Jest by opting out of the config that ships with Snowpack? |
I had to downgrade to jest v26 meanwhile. It would be really interesting to get jest v27 support. |
So I've forked locally to figure out a fix, and the package needs a couple of changes to work. The
// @remove-file-on-eject
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict'
const babelJestMd = require('babel-jest')
const importMetaBabelPlugin = require('./importMetaBabelPlugin')
const babelJest = babelJestMd.__esModule ? babelJestMd.default : babelJestMd
module.exports = babelJest.createTransformer({
presets: ['babel-preset-react-app', '@babel/preset-react', '@babel/preset-typescript'],
plugins: [[importMetaBabelPlugin]],
}) |
* Upgrade babel-jest version This is to match with the current version of Jest. Also Jest is added as a peer dependency to reflect this. * Change the babel jest transform script This is done to reflect the new API changes in babel-jest. The second line is done so that it can stay backwards compatible with Jest 26 if needed. References: #3398 (comment) jestjs/jest#11444 (comment) * Use jsdom as a test environment to run jest This is done so the react testing-library can render the DOM elements in testing.
I'm on babel-jest 27.4.2 and what worked for me is pinning jest-playwright-preset to 1.6.0. The error was happening with jest-playwright 1.7 in my case. |
I was able to make this work by using Jest 26. The NPM version (2.0.1, published 9 months ago) that gets installed locally only works with Jest 26, however the source code is version 2.0.1 (updated 2 months ago) and supports Jest 27. Seems it was fixed and forgot to get published with a new version. |
You are right, facing same issue. Hopefully someone from the team (@drwpow ?) will do a new release for "@snowpack/app-scripts-react". |
I had this error when I updated from Jest 26 to 27 without updating babel-jest from 26. Once I updated babel-jest to 27, solved. |
- Remove @snowpack/app-scripts-react config - FredKSchott/snowpack#3398
Bug Report Quick Checklist
Describe the bug
@snowpack/app-scripts-react is not compatible with Jest 27.
Looks like the
babel-jest
dependency should be updated to 27.Expected behavior
Tests cases should be executed.
The text was updated successfully, but these errors were encountered: