The "path" argument must be of type string. Received undefined for nx 14 - when running migration "update-jest-config-extensions"
See original GitHub issueCurrent Behavior
We’ve upgraded from nx 13.10 to the latest available 14.1.1. When we run the migration “update-jest-config-extensions” we received the error: We figured out its caused when you have any configuration block inside the test-target.
Running migration update-jest-config-extensions
The "path" argument must be of type string. Received undefined
Expected Behavior
We expect the migrations to succeed.
Steps to Reproduce
I’ve reproduced the issue in a fork, see here of your nx examples.
git clone git@github.com:WtfJoke/nx-examples.git
git checkout jest-config-migration
yarn install
yarn nx migrate --run-migrations
Failure Logs
yarn run v1.22.18
$ nx migrate --run-migrations --verbose
> NX Running 'yarn' to make sure necessary packages are installed
[1/4] Resolving packages...
success Already up-to-date.
$ ngcc --properties es2015 browser module main && node decorate-angular-cli.js
> NX Angular CLI has been decorated to enable computation caching.
> NX Running migrations from 'migrations.json'
Running migration 14-0-6-remove-root
Successfully finished 14-0-6-remove-root
---------------------------------------------------------
Running migration 14-0-0-change-nx-json-presets
Successfully finished 14-0-0-change-nx-json-presets
---------------------------------------------------------
Running migration 14-0-0-change-npm-script-executor
Successfully finished 14-0-0-change-npm-script-executor
---------------------------------------------------------
Running migration rename-module-federation-config
Successfully finished rename-module-federation-config
---------------------------------------------------------
Running migration update-jest-config-extensions
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:371:5)
at validateString (node:internal/validators:120:11)
at extname (node:path:1386:5)
at isJestConfigValid (/home/ryzen/dev/git/nx-examples/node_modules/@nrwl/jest/src/migrations/update-14-0-0/update-jest-config-ext.js:37:42)
at /home/ryzen/dev/git/nx-examples/node_modules/@nrwl/jest/src/migrations/update-14-0-0/update-jest-config-ext.js:61:18
at /home/ryzen/dev/git/nx-examples/node_modules/@nrwl/workspace/src/utilities/executor-options-utils.js:29:17
at Array.forEach (<anonymous>)
at forEachExecutorOptions (/home/ryzen/dev/git/nx-examples/node_modules/@nrwl/workspace/src/utilities/executor-options-utils.js:28:51)
at /home/ryzen/dev/git/nx-examples/node_modules/@nrwl/jest/src/migrations/update-14-0-0/update-jest-config-ext.js:59:61
at Generator.next (<anonymous>)
Done in 19.32s.
Environment
Node : 16.14.1
OS : linux x64
yarn : 1.22.18
nx : 14.1.1
@nrwl/angular : 14.1.1
@nrwl/cypress : 14.1.1
@nrwl/detox : Not Found
@nrwl/devkit : 14.1.1
@nrwl/eslint-plugin-nx : 14.1.1
@nrwl/express : Not Found
@nrwl/jest : 14.1.1
@nrwl/js : 14.1.1
@nrwl/linter : 14.1.1
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : 14.0.3
@nrwl/nx-plugin : Not Found
@nrwl/react : 14.1.1
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 14.1.1
@nrwl/web : 14.1.1
@nrwl/workspace : 14.1.1
typescript : 4.6.3
rxjs : 6.5.5
---------------------------------------
Community plugins:
@ngrx/component-store: 13.0.1
@ngrx/effects: 13.0.1
@ngrx/entity: 13.0.1
@ngrx/router-store: 13.0.1
@ngrx/store: 13.0.1
@ngrx/store-devtools: 13.0.1
(node:30927) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /home/ryzen/dev/git/nx-examples/node_modules/tslib/package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
Done in 1.05s.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
react native - nrwl/expo - The "path" argument must be of type ...
NX ERROR The "path" argument must be of type string. Received undefined. I changed nothing in the project. I just wanted to make...
Read more >nrwl-nx/community - Gitter
Ive added @nrwl/node but when i run nx g @nrwl/node:application appname all i get is Cannot read property 'types' of undefined . is...
Read more >migrate - CLI command - Nx
Creates a migrations file or runs migrations from the migrations file. - Migrate packages and create migrations.json (e.g., nx migrate ...
Read more >The "path" argument must be of type string" : r/vscode - Reddit
"[ERR_INVALID_ARG_TYPE]: The "path" argument must be of type ... Then reinstalling VSCode, you should be able to add the ... 14 days ago....
Read more >Pulse · nrwl/nx · GitHub
Error while creating Angular component: The "path" argument must be of type string. Received undefined. #13874 closed Dec 19, 2022. NX cannot successfully ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@fedelman this should be fixed in #10035
what is happening is an error not being able use
runInContext
because the context doesn’t include the relative path imports. I’m hoping to get that PR merged here soon.for the @WtfJoke it looks like the migratory wasn’t able to locate the defined jest config for your project.
so make sure the
@nrwl/jest:jest
exector options point to the correct jest config. what I gather is this is the line where it’s breakinghttps://github.com/nrwl/nx/blob/master/packages/jest/src/migrations/update-14-0-0/update-jest-config-ext.ts#L68