-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
Karma unit test failures: Cant resolve fs, no tests run #996
Comments
Could be #970. |
Reverting #970 fixed the error, but still 0 tests completed |
I also found a fix that was explicitly installing fs. |
@chrisckc could you have a look? |
Had a quick look at the 2 issues: First issue: The error "Module not found: Error: Can't resolve 'fs' in" can be fixed by adding the following to the webpack config: Second issue with the tests not running: It would seem that the SplitChunksPlugin, well actually Webpack v4 itself is incompatible with the version of karma-webpack (v3.0.5) used in the CLI generated package.json. To resolve the issue use karma-webpack v4.0.0-RC.3
That version automatically disables optimisation in webpack config by setting it to false. |
Fixes error: "Module not found: Error: Can't resolve 'fs' in" Fixes issue where tests dont run in webpack v4 Fixes: aurelia#996
This error is thrown on Node 8 and Node 10, but not Node 6.
|
@davismj I just hit that as well. The workaround for me was to add a The top fragment of my
|
Should we only use jest in the default webpack setup? So at least users can get a working skeleton. |
@peitschie that sounds like it should be fixed in karma-coverage-istanbul-reporter. I read from webpack doc, when context is undefined, "By default the current directory is used". But karma-coverage-istanbul-reporter tries to read It should be reading |
@peitschie I am not sure what did I do wrongly. I have a default webpack skeleton. The |
@huochunpeng sorry, I wasn't clear with my comment. The fs issue requires the tweak specified in #996 (comment). My additional config change fixes the next issue @davismj encountered where the coverage was throwing an The tweaks to my webpack to get this working again were:
|
Another tweak is also required for
|
#970 has been reverted, karma looks fine now.
@rockResolve I cannot reproduce your 0 tests issue after reverting #970. |
No longer using karma, moved to jest |
@EisenbergEffect let's close this issue for now. |
I'm submitting a bug report
au cli 1.0.0-beta.7
Please tell us about your environment:
Operating System:
Windows 10
Node Version:
10.13.0
NPM Version:
6.4.1
Browser:
Chrome 70
Language:
TypeScript 3.2.1
Loader/bundler:
Webpack
Current behavior:
To reproduce:
au new
choose Default Typescript setup
run au karma
I get the following error
ERROR in .../Default TypeScript/node_modules/jest-message-util/build/index.js
Module not found: Error: Can't resolve 'fs' in '...\Default TypeScript\node_modules\jest-message-util\build'
@ .../Default TypeScript/node_modules/jest-message-util/build/index.js 8:10-23
@ .../Default TypeScript/node_modules/jest-matchers/build-es5/toThrowMatchers.js
@ .../Default TypeScript/node_modules/jest-matchers/build-es5/index.js
@ .../Default TypeScript/test/karma-bundle.js
ERROR in .../Default TypeScript/node_modules/snapdragon/lib/source-maps.js
Module not found: Error: Can't resolve 'fs' in '...\Default TypeScript\node_modules\snapdragon\lib'
@ .../Default TypeScript/node_modules/snapdragon/lib/source-maps.js 3:9-22
@ .../Default TypeScript/node_modules/snapdragon/lib/compiler.js
@ .../Default TypeScript/node_modules/snapdragon/index.js
@ .../Default TypeScript/node_modules/micromatch/lib/utils.js
@ .../Default TypeScript/node_modules/micromatch/index.js
@ .../Default TypeScript/node_modules/jest-message-util/build/index.js
@ .../Default TypeScript/node_modules/jest-matchers/build-es5/toThrowMatchers.js
@ .../Default TypeScript/node_modules/jest-matchers/build-es5/index.js
@ .../Default TypeScript/test/karma-bundle.js
In addition no tests are actually run. The output has
SUMMARY:
√ 0 tests completed
karma tests should run without errors
The text was updated successfully, but these errors were encountered: