Jest (JS) 11 segmentation error in IO.js 1.4.3 when using require ()

I use IO.js 1.4.3 and Jest to run my test suites. I need a newer version of V8 because I use ES6 features like Promises.

If I try the simplest possible test:

describe('the truth', function() { it('is true', function() { expect(true).toBeTruthy(); }); }); 

it works (fortunately). However, if I include a call to require() (which I have to do to check my own code), I get:

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

This happens no matter which module I plug into, and whether I first call jest.dontMock() .

Actually this does not tell me a lot of qua error messages, and require really seems to be a problem. Are there any solutions for this besides returning to pre-1.0 node.js?

+5
source share
2 answers

This happens in cases where you installed node_modules using node in some version, and then switched to iojs using nvm install iojs and tried to run the installed node_modules with npm . It doesn't seem like this is your problem, but hopefully someone else will go along the path, try it and fix it.

 nvm install iojs rm -rf node_modules npm install 

then run whatever you are trying to run, usually something like npm run start .

+2
source

Segmentation errors almost always come from native C ++ code, since JS cannot cause such failures if it does not cause a V8 error. Thus, I suspect that the problem is with the context native module, which jokes indirectly depends on (via jsdom).

Perhaps you should try to hack a version of the joke, which depends on the latest jsdom, which no longer has a dependency on its own module.

0
source

Source: https://habr.com/ru/post/1214754/


All Articles