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

"TypeError: environment.dispose is not a function" when running tests #4243

Closed
gaearon opened this issue Apr 3, 2018 · 3 comments
Closed

Comments

@gaearon
Copy link
Contributor

gaearon commented Apr 3, 2018

create-react-app myapp
cd myapp
npm install lint-staged
rm -rf node_modules
npm install
npm test

gives an error:

TypeError: environment.dispose is not a function

Related: jestjs/jest#5294 lint-staged/lint-staged#414

Some kind of dependency hell scenario caused by bad resolving somewhere. Need to explore working around on our side in 1.x until we can bump Jest to a version that doesn't have this problem.

@gaearon
Copy link
Contributor Author

gaearon commented Apr 3, 2018

Seems like jestjs/jest#5913 is the real bug here.

@gaearon
Copy link
Contributor Author

gaearon commented Apr 3, 2018

Landed a workaround in #4247

@gaearon gaearon closed this as completed Apr 3, 2018
@richb-hanover
Copy link

richb-hanover commented Apr 20, 2018

With CRA 1.1.4, I ran into a similar problem with a slightly different error message with setup, not dispose:

TypeError: environment.setup is not a function

It's a newish CRA install, starting life as 1.1.1. I upgraded to 1.1.4 using the step-by-step yarn add --exact react-scripts@1.1.N (N=2..4) steps as usual. I have not added jest to my package.json file.

Other useful info:

bash-3.2$ node --version
v8.9.4
bash-3.2$ npm --version
5.8.0
bash-3.2$ yarn --version
1.6.0
bash-3.2$ npm ls react-scripts
imwebclient-2@0.2.0 /Users/richb/github/imwebclient-2
└── react-scripts@1.1.4

Any thoughts on debugging this? What other info could I provide? (I have never tried running tests on this project before so I can't say whether it ever worked.) Thanks.

@lock lock bot locked and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants