Jest v24.8.0
On Windows, when project located in the network mapped folder, this line cause issue with resolving location and throw this error:
● Validation Error:
Preset ts-jest is invalid:
The "id" argument must be of type string. Received type object
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type object
at validateString (internal/validators.js:125:11)
at Module.require (internal/modules/cjs/loader.js:632:3)
at require (internal/modules/cjs/helpers.js:22:18)
at setupPreset (Y:\Projects\gw\node_modules\jest-config\build\normalize.js:219:14)
at normalize (Y:\Projects\gw\node_modules\jest-config\build\normalize.js:544:15)
at readConfig (Y:\Projects\gw\node_modules\jest-config\build\index.js:163:46)
at readConfigs (Y:\Projects\gw\node_modules\jest-config\build\index.js:372:26)
at Y:\Projects\gw\node_modules\@jest\core\build\cli\index.js:155:58
at Generator.next (<anonymous>)
at asyncGeneratorStep (Y:\Projects\gw\node_modules\@jest\core\build\cli\index.js:108:24)
Configuration Documentation:
https://jestjs.io/docs/configuration.html
npm ERR! Test failed. See above for more details.
If I change this line to prefix = ''; all work correctly.
I cannot understand what this line do (in current version), can someone explain purpose of it? Or it can be changed without any problems?
Try run jest from project located in the network mapped folder on Windows.
Tests run.
npx envinfo --preset jest System:
OS: Windows 10
CPU: (6) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Binaries:
Node: 10.15.3 - C:\Program Files\nodejs\node.EXE
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
Don't know if this will help you or not, but I had this exact error earlier today, which was solved with yarn add ts-jest.
My package.json had a jest configuration that looked like:
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
}
but I didn't have ts-jest installed.
@br-smith are you running your tests on a mapped windows network share though? That's what this specific issue is about
Update to last version of ts-jest: 25.0.0 and jest: 25.1.0 removed error for me
For me was missing just a yarn add -D ts-jest 😄
Update to last version of
ts-jest: 25.0.0andjest: 25.1.0removed error for me
jest: 25.1.0 , helped me!!! thx~
Most helpful comment
Don't know if this will help you or not, but I had this exact error earlier today, which was solved with
yarn add ts-jest.My package.json had a jest configuration that looked like:
but I didn't have
ts-jestinstalled.