...and a module at <rootDir>/src/add.js, this test fails with Cannot find module src/add.js:
import { expect } from 'chai';
import add from 'src/add';
it('should add numbers', () => {
expect(add(3, 3)).to.equal(6);
});
It does succeed when I remove the runner config option from jest, so I'm guessing that the mocha runner doesn't have a way to use jest's module resolution settings. I also tried doing NODE_PATH=./src yarn jest, but that didn't work, either.
Is there a recommended way to configure module paths? This would help a great deal with incremental migration.
I haven't found a way to resolve paths with the mocha runner. Using this config:
...and a module at
<rootDir>/src/add.js
, this test fails withCannot find module src/add.js
:It does succeed when I remove the
runner
config option fromjest
, so I'm guessing that the mocha runner doesn't have a way to use jest's module resolution settings. I also tried doingNODE_PATH=./src yarn jest
, but that didn't work, either.Is there a recommended way to configure module paths? This would help a great deal with incremental migration.