create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

allow ability for jest to "forceExit"

Open sandys opened this issue 9 years ago • 3 comments

https://github.com/facebook/jest/issues/1456

jest has the ability to forceexit after a test run. This is for some cases when tests dont clean up nicely after themselves.

There is no way in create-react-app to set this up. React-scripts also does not set this up. We are facing situations where we need forceexit in some cases for our CI and we are unable to wire a CRA project to do this.

We tried using setupTests.js, however since this a cli flag - we are not able to set this up even there.

sandys avatar Sep 18 '17 10:09 sandys

Any fixes? I am having the same issue

hannahapuan avatar Oct 25 '17 18:10 hannahapuan

Any update? Love to have this. Looks like we also need to update jest https://github.com/facebook/jest/pull/4105

vinhlh avatar Nov 02 '17 03:11 vinhlh

You can pass CLI flags to jest. In fact the default generated Jest command already shows how to do it in your package.json.

  "test": "react-scripts --env=jsdom --forceExit"

That said if it's not part of Jest 20, this won't work. We have an issue tracking updating Jest, and will do it in a few weeks.

gaearon avatar Nov 02 '17 16:11 gaearon