Jest: TypeError: Path must be a string. Received null

Created on 30 May 2016  ·  3Comments  ·  Source: facebook/jest

Using Jest CLI v0.9.2, jasmine2, babel-jest

Same issue as https://github.com/fbsamples/f8app/issues/52 but I don't use this module. Perhaps it is a submodule of anything else I am using, though.

 FAIL  spec/js/util/SanitationUtility.spec.es6
Runtime Error
TypeError: Path must be a string. Received null
    at assertPath (path.js:7:11)
    at Object.dirname (path.js:1324:5)
    at handle (/Users/stephanbijzitter/fabric_modules/node_modules/worker-farm/lib/child/index.js:41:8)
    at process.<anonymous> (/Users/stephanbijzitter/fabric_modules/node_modules/worker-farm/lib/child/index.js:47:3)
 FAIL  spec/js/FabricModules.spec.es6

Most helpful comment

I'm still experiencing this problem in 12.1.1, I'm also using babel-jest.

 FAIL  server/webtools/__tests__/checks-test.js
● Runtime Error
TypeError: Path must be a string. Received null
    at assertPath (path.js:7:11)
    at Object.dirname (path.js:1324:5)

edit: turns out jest-cli was installed globally and outdated, but jest was up to date.

All 3 comments

Solved by updating to 12.1.1 (possibly also by earlier versions)

For posterity: Node 6 has a stricter path module and we updated Jest to work with Node 6 in 12.0.1.

I'm still experiencing this problem in 12.1.1, I'm also using babel-jest.

 FAIL  server/webtools/__tests__/checks-test.js
● Runtime Error
TypeError: Path must be a string. Received null
    at assertPath (path.js:7:11)
    at Object.dirname (path.js:1324:5)

edit: turns out jest-cli was installed globally and outdated, but jest was up to date.

Was this page helpful?
0 / 5 - 0 ratings