New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node app generator unitTestRunner=none option throws error #9763
Comments
The same happens using |
After doing some research, this is what I found: function updateDependencies(tree: Tree) {
updateJson(tree, 'package.json', (json) => {
delete json.dependencies['@nrwl/node'];
return json;
});
...
} This is a function declared in let jestInstall: GeneratorCallback;
if (options.unitTestRunner === 'jest') {
jestInstall = await jestInitGenerator(tree, {});
}
const installTask = await updateDependencies(tree); if (!schema.unitTestRunner || schema.unitTestRunner === 'jest') {
const jestTask = jestInitGenerator(tree, {});
tasks.push(jestTask);
}
if (!schema.e2eTestRunner || schema.e2eTestRunner === 'cypress') {
const cypressTask = cypressInitGenerator(tree, {});
tasks.push(cypressTask);
}
const installTask = updateDependencies(tree); These are snippets from the same files I specified above, respectively. So, what happens here in practice, is that you probably do not have a I did a quick check with node's repl, and got the same error message. ▶ node
Welcome to Node.js v16.14.0.
Type ".help" for more information.
> let json = {}
undefined
> delete json.dependencies.hello
Uncaught TypeError: Cannot convert undefined or null to object Can you validate this? |
In any case, I've validated it with unit tests, I'm now opening a PR to fix this issue 👍🏻 |
Your findings seem correct, I did not have a Thank you so much for the quick response and fix! |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
Using
--unitTestRunner=none
innx generate @nrwl/node:application
throws the error:Cannot convert undefined or null to object
.Full error below.
This makes it impossible to generate an app without unittest runner ( which I suppose is a good thing, but still... 😉 ).
Expected Behavior
An app should be created without unittest runner and without error.
Steps to Reproduce
Run the following:
Failure Logs
With
npx nx generate @nrwl/node:application my-app --unitTestRunner=none
With
npx nx generate @nrwl/web:application my-app --style=css --e2eTestRunner=none --unitTestRunner=none
Environment
The text was updated successfully, but these errors were encountered: