You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to generate a test in a project that uses nrwl and is not able to find modules
Error: Cannot find module '@scwx/utils-alerts'
Require stack:
-
- /usr/local/lib/node_modules/ngentest/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1080:15)
at Function.Module._load (internal/modules/cjs/loader.js:923:27)
at Module.require (internal/modules/cjs/loader.js:1140:19)
at require (internal/modules/cjs/helpers.js:75:18)
at Object.<anonymous> (<anonymous>:13:24)
at Module._compile (internal/modules/cjs/loader.js:1251:30)
at requireFromString (/usr/local/lib/node_modules/ngentest/node_modules/require-from-string/index.js:28:4)
at run (/usr/local/lib/node_modules/ngentest/index.js:151:21)
at Object.<anonymous> (/usr/local/lib/node_modules/ngentest/index.js:220:3)
at Module._compile (internal/modules/cjs/loader.js:1251:30) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '', '/usr/local/lib/node_modules/ngentest/index.js' ]
}
The text was updated successfully, but these errors were encountered:
This happens when the test generator, which has an isolated environment, tries to compile your code. Which means it can't find your module.
As you seen in README.md, try using replacements.
This does not mean replacing your code. It just temporarily replace the code in memory.
replacements: There are some codes, which causes error without proper environment. You need to replace these codes. You can specify from value with regular expression and to value with string. e.g.
replacements: [
{ from: '^\\S+\\.define\\(.*\\);', to: ''}`
]
For example,
// faking import for errorenous lib.
replacements: [
{ from: '@scwx\\/utils-alerts, to: '@angular/core' }
]
I tried to generate a test in a project that uses nrwl and is not able to find modules
The text was updated successfully, but these errors were encountered: