jestjs/jest

Update to work with node v 0.12.0

benoneal opened this issue · 108 comments

As title.

#235 has some discussion around what needs to happen to make jest work on io.js. A lot of the same fixes will also apply to node 0.12.0

I'm having the same errors as #249 & #181 but on windows:

Error: Worker process exited before responding! exit code: 3221225477, exit signal: null stderr:

I can't even run the tests on node_modules/jest-cli folder as I get the same error.

Having the same issue as @Artsu

The same as many write above
Worker process exited before responding!

node v0.12.0

I'm having this issue when jest silently fails without telling what went wrong:

C:\Projects\react-starter-kit>jest
Using Jest CLI v0.4.0
Waiting on 1 test...
C:\Projects\react-starter-kit>

Using Windows, Node 0.12.0, jest 0.4.0

P.S.: It stopped working after updating to Node 0.12.0, but this issue was silently failing (without writing any errors to the console) was present with Node 0.10, jest 0.2, 0.3

I'm seeing the same crash as @Johnius with node 0.12.0 and jest 0.4.0 testing the simple React example.

Working well on v0.10.36

I got the same issue running jest on windows when I require react as in the default unit test example. I'm on version 0.12 of node.

jest

+1 huge blocker for me, all my tests fail.

+1 can't even write them :)

Any news on that?

+1

+1 tests completely broken :(

+1 Here, Tests were fine before node/npm upgrade. :(

+1

Here is a test repo, which can be used to reproduce the issue (fails at least on Windows + Node 0.12 or ios):

https://github.com/koistya/jest-sandbox

+1, I'm down with this issue too..any workarounds?

==> node --version
v0.12.0

==> npm --version
2.5.1

==> npm test

flux@0.0.0 test /Users/.....
jest

Using Jest CLI v0.4.0
Waiting on 1 test...Segmentation fault: 11

+1.. dead in the waters

+1 Having the same problem

+1 hope it will be fixed soon

+1

Can we stop with the "+1" bullshit ? I think maintainers are aware of the problem.

@dgellow agree +1 :)

flq commented

If maintainers are aware I suppose that whole +1 stuff would stop if they would acknowledge the awareness by making a simple statement along the lines of "yeah we know,but it's complicated/hasn't high prio/chickens for sacrifice haven't arrived yet". Until then people will keep knocking the door to show that they are getting burned right now by this issue.

zpao commented

It's known and has to do with JSDOM + contextify mostly. Please stop with the +1s.

@zpao quick question here, what are jest devs thoughts on the fact jsdom-4.0.0 isn't supporting node anymore and instead will depend on iojs which will allow them to remove the dependency on contextify's native module? Should that get this problem solved?

zpao commented

Mixed feelings. There's some more discussion in #267

Thanks will follow the conversation over there then :)

Can anyone recommend a thread to follow on the node v0.12.0 support progress? Is this it? Thanks 🐋

Is there some combination of Node and Jest versions that is known to still work?

@mindjuice Node v0.10.36 & Jest v0.4.0 work together for me

@mindjuice, take a look at the package.json for jest-cli. At line 32 it specifies node 0.8.x || 0.10.x. Version 0.10.36 is the latest stable that meets that requirement.

Just to confirm, v0.10.36 does work for me with Jest v0.4.0, but I needed to uninstall Jest first and then reinstall it, otherwise I got errors from contextify. I've included the error output below in case it helps anyone find this message.

Using Jest CLI v0.4.0
Waiting on 2 tests...dyld: lazy symbol binding failed: Symbol not found: _node_module_register
  Referenced from: /Users/kenc/dev/dashboard/node_modules/jest-cli/node_modules/jsdom/node_modules/contextify/build/Release/contextify.node
  Expected in: dynamic lookup

dyld: Symbol not found: _node_module_register
  Referenced from: /Users/kenc/dev/dashboard/node_modules/jest-cli/node_modules/jsdom/node_modules/contextify/build/Release/contextify.node
  Expected in: dynamic lookup

dyld: lazy symbol binding failed: Symbol not found: _node_module_register
  Referenced from: /Users/kenc/dev/dashboard/node_modules/jest-cli/node_modules/jsdom/node_modules/contextify/build/Release/contextify.node
  Expected in: dynamic lookup

dyld: Symbol not found: _node_module_register
  Referenced from: /Users/kenc/dev/dashboard/node_modules/jest-cli/node_modules/jsdom/node_modules/contextify/build/Release/contextify.node
  Expected in: dynamic lookup

 FAIL  app/js/components/__tests__/CheckboxWithLabel-test.js
Error: Worker process exited before responding! exit code: null, exit signal: SIGTRAP
stderr:
  dyld: lazy symbol binding failed: Symbol not found: _node_module_register
  Referenced from: /Users/kenc/dev/dashboard/node_modules/jest-cli/node_modules/jsdom/node_modules/contextify/build/Release/contextify.node
  Expected in: dynamic lookup

dyld: Symbol not found: _node_module_register
  Referenced from: /Users/kenc/dev/dashboard/node_modules/jest-cli/node_modules/jsdom/node_modules/contextify/build/Release/contextify.node
  Expected in: dynamic lookup

A worker process has quit unexpectedly! This is bad news, shutting down now!
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

+1

$ node -v
v0.12.1
$ npm -v
2.5.1
$ npm test

Using Jest CLI v0.4.0
Waiting on 1 test...sh: line 1: 87723 Segmentation fault: 11  jest
npm ERR! Test failed.  See above for more details.

I'm using this as a temporary workaround so I can at least run tests until a fix is released.

# Switch to previous version
nvm use 0.10

# Re-install all dependencies
rm -rf node_modules/
npm install

# Run tests
npm test
zpao commented

@atridgedcosta (and anybody else doing that) just FYI. npm rebuild will rebuild binary packages for the current version of node so you don't have to rm -rf node_modules.

Any ETA on when this can be fixed and released ? I am using Koa which needs minimum node 0.11 as is based on generators ...

@BobbyKostadinov It seems like it'll be a while with JSDOM dropping support for node...

Out of curiosity, since this is a Facebook "product" -- I assume Jest is used by a lot of people there, at scale. Do you guys not rely on node? Or stick to an older version? Or use io.js? Or neither one or the other?

zpao commented

For the most part we use 0.10.

+1

$ node -v
v0.12.0
$ npm -v
2.7.1
$ npm test

Using Jest CLI v0.4.0
Waiting on 1 test...[1]    83918 segmentation fault  npm test

As this doesn't look like it's going to be resolved anytime soon due to JSDOM dropping node support, the only solution seems to be switching to io.js. That does help, though and - since it's more or less just an updated node version - seems to be a drop-in replacement for node.

My react+webpack app didn't work when I tried it on io.js (didn't forget to reinstalled node_modules). Unfortunately I had no time to investigate but it looks like io.js is not fully compatible.

@pvolok you have to npm rebuild On your project after you change to iojs.

@SupremeTechnopriest I removed node_modules and ran npm install which failed.

@pvolok hmm perhaps one or more of your dependencies are out of date? You can try using this https://www.npmjs.com/package/npm-check-updates to update any old packages.

zpao commented

I believe io.js has the same problem as node v0.12 so I don't expect jest works there either.

@zpao I was experiencing the same issues with node 0.12 and iojs v1.6.3 solved the problem.

I confirm, I just switched to io.js v1.6.4 and npm 2.7.5, that solved my problem as well (react+webpack). If you are on OSX, do not bother installing with Homebrew at the moment, you will get a boatload of errors later on -- you need the patched npm that comes with the official io.js installer.

How certain can we be that tests that pass in io.js or node 0.10 should also pass in node 0.12?

I feel like if you're using node 0.12 in production, then testing against different JavaScript engines seems less than ideal.

Is there another testing framework, that is not jest but works well with react, that would be better suited for testing react applications targeting node 0.12?

@woodb, for me at this point, if you're using node v0.12 in production then jest might not be the right solution for you. I'd recommend switching to iojs or node v0.10 in production if jest is an important tool for you.

wow, iojs v1.6.4 does work. It seems that brianmcd/contextify#154, published as contextify@0.1.13, fixed the problem. jsdom@0.10.6 depends on contextify@~0.1.5, and since contextify@0.1.13 falls in that range - voila fixed!

nkbt commented

IO.js of any version does not seem to work for me. Tried multiple versions and had different issues every time. The gist with all errors I got: https://gist.github.com/nkbt/60879438db2b2411bb52

There are tests for iojs v1.2.0 ... v1.8.1, node 0.12.x and 0.10.x. So the only way to make installation + tests pass (at least for me) was to use node 0.10.x

To eliminate any project specific issues, I am doing clean install of Jest to run examples.

+1

$ npm -v
2.7.4
$ node -v
v0.12.2
$ npm test

Using Jest CLI v0.4.0
FAIL  scripts/components/__tests__/bookNav-test.js
Error: Worker process exited before responding! exit code: null, exit signal: SIGSEGV
stderr:

A worker process has quit unexpectedly! This is bad news, shutting down now!
npm ERR! Test failed.  See above for more details.

+1, I just want to state that this is a huge block for integrating jest into my project, at least node 0.11 should be supported.

nkbt commented

It really feels like a blocker. At least for any relatively fresh project. For now I had to step back to karma+jasmine which actually works ok on any version of node and iojs (at least any version i was working on).

It is quite clear that that problem is rather with jsdom than jest itself. But jsdom is full-on with iojs, so it looks at least awkward that jest does not work with iojs.

I've been using jest with no problems on iojs 1.6.3 from nvm. You just have to make sure your binaries are built for iojs. nvm use iojs && mom rebuild


Randy LebeauVP of Product

On Sun, May 3, 2015 at 4:53 AM, Nik Butenko notifications@github.com
wrote:

It really feels like a blocker. At least for any relatively fresh project. For now I had to step back to karma+jasmine which actually works ok on any version of node and iojs (at least any version i was working on).

It is quite clear that that problem is rather with jsdom than jest itself. But jsdom is full-on with iojs, so it looks at least awkward that jest does not work with iojs.

Reply to this email directly or view it on GitHub:
#243 (comment)

nkt commented

@nkbt yep, latest version of jsdom is 5.3.0, but jest uses 0.10.3

Does jest supports at all?

nkbt commented

@SupremeTechnopriest I made clean install for each version, cleaning all caches. Rebuild was done as well. Not sure why that didn't work out for me with iojs 1.6.4. I posted my logs as gist. Actually for 1.6.4 issue was not with jsdom, but with actually running tests:

● FakeTimers › runWithRealTimers › it resets mock timers after executing callback
  - TypeError: Cannot read property 'Matchers' of undefined
        at matchersClass (/Users/nkbt/nkbt/jest/vendor/jasmine/jasmine-1.3.0.js:739:12)

This is insane! All men abandon ship! This issue has been open for three months!!!

@Frikki might be joking but the man has a point, even more when you see the above issue linked ⬆️, mocha or jasmine plus karma work really fine, also with karma-browserify you can interact pretty easily with ES6 / CJS modules, and finally with packages such as proxyquire and rewire the mocking capabilities of Jest are achieved.

Of course, it will be nice to have all this achieved and solved by a single package but that also might conflict with the ideals of node.js modules: do one thing and one thing right.

In any case, for those of us wanting a Jest option, there is one!

@Frikki i'm afraid that you have a point :(

I want to believe 👽...

👍

+1

Every time you +1 47 people get an email. I'm sure they are aware of the issue.

Yes, please stop with the +1. This isn’t really a jest issue. JSDOM dropped support for node > 0.11, because they boys at Joyent don’t have their shit together.

From https://github.com/tmpvar/jsdom https://github.com/tmpvar/jsdom

Note that as of our 4.0.0 release, jsdom no longer works with Node.js™, and instead requires io.js. You are still welcome to install a release in the 3.x series if you use Node.js™.

On May 13, 2015, at 1:58 PM, Rob Middleton notifications@github.com wrote:

Every time you +1 47 people get an email. I'm sure they are aware of the issue.


Reply to this email directly or view it on GitHub #243 (comment).

lock issue if you don’t want to receive +1

zpao commented

Locking the issue is the nuclear option and shouldn't have to be required. It should be fairly obvious that this is a known issue and that +1 is noisy and adds zero to the conversation. I can understand that you're frustrated but +1 does nothing except annoy 49 people.

🔒

FYI: We're going to invest into io.js update, and 0.10 will likely be the final version for legacy node (since new jsdom version which we also updating doesn't support 0.12 and below). It's likely be an update for jest 0.5, and 0.4 will still work with 0.10.

As of #374, Jest should work on latest io.js. It's currently in a separate branch, https://github.com/facebook/jest/tree/0.5.x, and can also be installed via npm facebook/jest#0.5.x. Later on we'll consider moving to io.js, and making this branch as master (and when Node 2.0 will fully be merged with io.js, it automatically work with node). If you use io.js, we'll be glad to get the feedback on the experience with 0.5.x.

@DmitrySoshnikov Thanks! Can you publish it to npm under a beta/iojs/whatever tag?

Many thanks, finally! They work like a charm on the latest iojs and I have quickly published a new gulp plugin that goes well: https://github.com/binarykitchen/gulp-jest-iojs

Any update so far? It's been almost 5 months since we found this issue, and unfortunately, we have to stay with node v0.10 rather than the latest version purely because of the jest.

@binarykitchen thanks.

Just wonder if I use node + grunt, anything else we can use?

well, i am afraid, this one package i did is for gulp only

@binarykitchen all good. Thanks anyway. 👍

@tchcxp Just write your own grunt module. It's not that hard. Gulp is better anyway its worth switching over IMHO.

What planes are for the future of Jest? I'm trying to decide between switching to io.js and use Jest, or stay with node and use something different. I'm really fond of idea to use io.js with Jest, but would like to know if it will work fine in the future too

@SupremeTechnopriest io.js joined node and future versions of node.js are going to be based on io.js. So switching should not be a problem. https://medium.com/node-js-javascript/io-js-week-of-may-15th-9ada45bd8a28

@s-pmpodolski using https://www.npmjs.com/package/gulp-jest-iojs for now is safe until FB has officially released an iojs compatible Jest package

@binarykitchen sure, thank you :D I'm just curious about FB plans for Jest library in the future

i am sure they have plans - there are lots of commits in the 0.5x branch

All our software is written on v0.12.

Do we just have to wait until the merge in order to run tests? Seems kind of bizarre that jest would not support v0.12, especially for almost half a year...

@chapinkapa, would you consider switching to io.js (and installing Jest form 0.5.x branch), or do you have some blockers in other software that don't run on io.js? We had dependencies issus with 0.12, especially with jsdom which doesn't support 0.12 either.

Ah, gotcha. Unfortunately I am at a fairly large company that wants to only use the latest stable branch of Node (for supposed stability). We are using Node 0.12 for several of our servers.

+1

Works in in 0.10.40, not io.js 2.3.0 with Jest 0.5.0

mull commented

@harryworld works with iojs 2.5.0 at least.

@mull I tried that, the error mentioned here is gone, but the tests are not all passed due to some libraries not included. For instance:

 FAIL  __tests__/Mutation-test.js (0.39s)
● Mutation Generators › it generates a Set Mutation
  - ReferenceError: Parse is not defined
 FAIL  __tests__/ObjectStore-test.js (0.388s)
● Object storage › it supplies data for all pointers that exist at the same depth
  - ReferenceError: query is not defined
mull commented

@harryworld if Parse is not defined then you need to include it. query is not defined sounds like a missed var.

@mull Interesting, why the same code base (with Jest 0.4.19) can work in 0.10.40? I did not rm -rf node_modules?

P.S> I'm new to Jest, not sure about its magic yet.

mull commented

I couldn't tell you. I noticed the same thing about a missing var when going from 0.10 to iojs2.5. Can't tell you why. :)

I'm going to close this out as we won't be able to support node 0.12 unfortunately. A decision that was made for us by jsdom. We'll likely be able to reconcile once node v4 comes out, which should support a reasonable upgrade path from node 0.12.

More explanation: #469 (comment)

@mull @harryworld indeed, you need to define all variables. I think jsdom became stricter in how it handles the global scope.

guys, just use https://www.npmjs.com/package/gulp-jest-iojs for the time being until iojs v4 has been merged with nodejs