Webpack + karma misses jest plugins
See original GitHub issueI’m submitting a bug report
- Library Version: 0.31.3
Please tell us about your environment:
-
Operating System: Linux (Ubuntu)
-
Node Version: 7.7.3
- NPM Version: 5.0.3
-
Browser: all
-
Language: all
-
Loader/bundler: Webpack
Current behavior:
Choosing the webpack bundler with karma for testing, one gets two errors for missing jest modules on running au karma
:
ERROR in ./test/karma-bundle.js
Module not found: Error: Can't resolve 'jest-jasmine2/jasmine-async' in '/home/shoff/workspaces/awk/test'
@ ./test/karma-bundle.js 3:0-77
ERROR in ./test/karma-bundle.js
Module not found: Error: Can't resolve 'jest-matchers' in '/home/shoff/workspaces/awk/test'
@ ./test/karma-bundle.js 52:15-39
I tested this with a fresh project both for babel and typescript.
Installing jest-matchers
took care of the second error, but npm i --save-dev jest-jasmine2
didn’t do the trick for jest-jasmine2/jasmine-async
.
- What is the expected behavior?
The au karma
command should run without errors on a newly created webpack setup.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
karma-webpack not running tests - Stack Overflow
I've put breakpoints into the test scripts, and even the tests.bundle.spec.js code (e.g. when setting the context for require) but none of the ......
Read more >karma-jest - npm Package Health Analysis - Snyk
A Karma framework for using some of Jest's best features in a browser. For more information about how to use this package see...
Read more >Unit Testing - Webpack from Nothing
Let's create a second Webpack configuration that will produce a test-only bundle that we can feed to Jest. We'll place this in test/webpack.test.config.js...
Read more >Testing React and Flux Applications with Karma and Webpack
This article explains how we've ditched Jest in favor of Karma, Webpack, and Jasmine. The same test suite running under our new setup...
Read more >How do Testing in Ionic 6 with React and Karma - Medium
Hi , recently i found out that using JEST for teting an ionic app ... are not needed for karma-webpack plugin like ,...
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
Adding
jest-matchers
to the dev dependencies should do the trick. Thats what fixed it for me.For those not running
32.0
and getting thejest-jasmine2/jasmine-async
error: Go to yourkarma-bundle.js
and change the import from'jest-jasmine2/jasmine-async'
to'jest-jasmine2/jasmine_async'
.@s-hoff thanks for the update. I wonder if we can separate the karma and jest setups entirely so that when you only need karma you don’t need to install any jest libraries