question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack + karma misses jest plugins

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
s-hoffcommented, Nov 27, 2017

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 the jest-jasmine2/jasmine-async error: Go to your karma-bundle.js and change the import from 'jest-jasmine2/jasmine-async' to 'jest-jasmine2/jasmine_async'.

0reactions
JeroenVinkecommented, Nov 28, 2017

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found