Uh oh!
There was an error while loading. Please reload this page.
Upgrade jest from 26.6.0 to 27.0.0-next.6 - #10748
Conversation
facebook-github-bot
commented
Mar 25, 2021
Hi @ankurkaushal! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
ankurkaushal
commented
Mar 25, 2021
Looking into the CI failures. 👀 |
facebook-github-bot
commented
Mar 25, 2021
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Uh oh!
There was an error while loading. Please reload this page.
renatoalencar
commented
Mar 25, 2021
I guess the tests are failing because of this file https://github.com/facebook/create-react-app/blob/master/packages/react-error-overlay/src/utils/getSourceMap.js#L117 accessing the window object which doesn't exist on the node environment. I could add the code below to this file https://github.com/facebook/create-react-app/blob/master/packages/react-error-overlay/src/__tests__/get-source-map.js in order to properly setup the correct environment. /** * @jest-environment jsdom */ |
ankurkaushal
commented
Mar 25, 2021
@renatoalencar Hmm, now it worked & the test in question is passing 🤔 Looks like I was missing the upgrade in rest of the packages in 3f03a63 |
ankurkaushal
commented
Mar 25, 2021
@SimenB: Seeing a different error now:
|
renatoalencar
commented
Mar 25, 2021
If we're seen errors we are having some progress. Now it looks like this file https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/jest/babelTransform.js is doing a require on an ES module, which export things on a default property. |
renatoalencar
commented
Mar 25, 2021
This is the import constbabelJest=require('babel-jest');This is what is being exported exportdefaulttransformer;If you put a default property at the end of the require call it should probably work. Like this constbabelJest=require('babel-jest').default; |
ankurkaushal
commented
Mar 25, 2021
@renatoalencar That worked! Thank you catching that :) |
gaearon
commented
Mar 25, 2021
@ankurkaushal Btw thank you for quickly jumping on this, it's really appreciated. |
ankurkaushal
commented
Mar 25, 2021
@gaearon: My pleasure, always happy to help & I didn't want to miss an opportunity to collaborate with you! I see a lot of checks are still failing, looks like something to do with fixtures? Would re-running jest with |
gaearon
commented
Mar 25, 2021
What is the error? |
gaearon
commented
Mar 25, 2021
Is this what you're seeing too? |
ankurkaushal
commented
Mar 25, 2021
No actually, I ran that & it just ran the server & quit. |
renatoalencar
commented
Mar 25, 2021
Since some of those tests are testing the testing environment (this sound funny), I think you should probably change those to match the requirements of this new version of Jest. Since this is a breaking change in Jest, it would make sense to break something like this. What do you think @gaearon? Can you run e2e tests locally @ankurkaushal? |
ankurkaushal
commented
Mar 25, 2021
@renatoalencar: Yep I can run it via |
renatoalencar
commented
Mar 25, 2021
I'll run it here too and see what I find. |
ankurkaushal
commented
Mar 25, 2021
@renatoalencar: Only error I see is this:
What about you? |
renatoalencar
commented
Mar 25, 2021
Yeah, same thing here 😞. Let's check for behavior first, then all the cases. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
renatoalencar
commented
Mar 26, 2021
@SimenB there's a lot of timeouts on the CI logs, do you have any idea why? |
SimenB
commented
Mar 26, 2021
Nope, I have no idea what the tests are doing |
renatoalencar
commented
Mar 26, 2021
This specific test case is timing out, but there's I'm trying increasing directly on the file, let's see if that works. |
ankurkaushal
commented
May 26, 2021
Updated to new version of For example, I get this error in FAIL template/src/App.test.js
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do: • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. • If you need a custom transformation specify a "transform" option in your config. • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation
Details:
SyntaxError: /Users/ankurkaushal/projects/create-react-app/packages/cra-template/template/src/App.test.js: Support for the experimental syntax 'jsx' isn't currently enabled (5:10): 3 | 4 | test('renders learn react link', () => {
> 5 | render(<App />);| ^
6 | const linkElement = screen.getByText(/learn react/i);
7 |expect(linkElement).toBeInTheDocument();
8 | });
Add @babel/preset-react (https://git.io/JfeDR) to the 'presets' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://git.io/vb4yA) to the 'plugins' section to enable parsing.
at Parser._raise (../../node_modules/@babel/parser/src/parser/error.js:134:45)
at Parser.raiseWithData (../../node_modules/@babel/parser/src/parser/error.js:129:17)
at Parser.expectOnePlugin (../../node_modules/@babel/parser/src/parser/util.js:191:18)
at Parser.parseExprAtom (../../node_modules/@babel/parser/src/parser/expression.js:1212:18)
at Parser.parseExprSubscripts (../../node_modules/@babel/parser/src/parser/expression.js:616:23)
at Parser.parseUpdate (../../node_modules/@babel/parser/src/parser/expression.js:596:21)
at Parser.parseMaybeUnary (../../node_modules/@babel/parser/src/parser/expression.js:563:23)
at Parser.parseExprOps (../../node_modules/@babel/parser/src/parser/expression.js:367:23)
at Parser.parseMaybeConditional (../../node_modules/@babel/parser/src/parser/expression.js:332:23)
at Parser.parseMaybeAssign (../../node_modules/@babel/parser/src/parser/expression.js:287:21)Am I missing something here with the |
Upgrades from 27.0.1 to 27.0.3
Latest Update: Updated to new version of
Not sure if my machine has something funky going on or is there anything else I need to double check? Would appreciate another pair of eyes on this. |
mandaputtra
commented
Jul 20, 2021
@ankurkaushal how do you test this branch? Would love some advice on that, I'll try to use 27.0 jest versions. |
yifanwww
commented
Aug 20, 2021
For the first error and the third error, add I'm not sure whether jest can find that jest.config.js by itself. You may need to execute BTW, you forgot to upgrade |
iansu
commented
Sep 22, 2021
I'm going to close this in favour of #11338 since the tests are all passing in that PR. Thank you for your contribution. |
Closes#10747. Fixes#9993.