Questions tagged [karma-webpack]

npm package to connect karma with webpack

npm package to connect karma with webpack https://github.com/webpack/karma-webpack

171 questions
2
votes
0 answers

Do I need to add sourcemap preprocessor in karma even though I have devtool in webpack config

I have karma preprocessor as 'preprocessors: { './spec/tests.webpack.js': ['webpack','sourcemap'] }, reporters: ['coverage-istanbul'], singleRun: true, webpack: webpackConfig' And my webpackConfig has devtool as inline-source-map. Even…
Rajan
  • 67
  • 1
  • 8
2
votes
1 answer

How to run unit tests by chunks in karma-webpack?

We are using following technologies in our project: angularjs+typescript+webpack+karma+phantomjs We have more than 1000 unit tests in the project which are run bu karma-phantomjs-launcher and on windows machines phantoms crashes with the following…
VladosJS
  • 1,210
  • 8
  • 20
2
votes
2 answers

Angular-CLI Code Coverage Issue

I have ejected my angular-cli project and cannot get any code coverage working. I have tried various packages and configurations and cannot seem to find the right combo. When I run npm run test the tests DO run successfully and shows the Chrome…
2
votes
2 answers

Karma config - including other config files

I haven't seen anything on this, but I was wondering if it was possible to include multiple karma-conf.js files in a single Karma run? Basically, I'm thinking of having a configuration with coverage and tslint for CI as well as a configuration with…
Skeeterdrums
  • 460
  • 1
  • 6
  • 13
2
votes
3 answers

Angular 2 npm test - Can not load "webpack"

I'm seeing an error when I try to run npm test 08 09 2017 16:50:50.240:ERROR [preprocess]: Can not load "webpack"! TypeError: Cannot read property 'plugin' of undefined at PathsPlugin.apply…
Martyn
  • 6,031
  • 12
  • 55
  • 121
2
votes
1 answer

Can't create a KeyboardEvent for testing an input component (angular) within Internet Explorer 11

We have our up and running karma test suite for our angular application. All tests are green for chrome. Now I have to fix a test which is failing for IE 11. The exception I get is the following: TypeError: Object doesn't support this action …
2
votes
0 answers

reactjs / Webpack 3 - how to compile scss into a separate css file?

How to convert the .scss to .css files while copying(CopyWebpackPlugin(){}) them to the dist/ folder but I’m not able to figure it out. Using copy-webpack-plugin version --- 4.0.1 My package structure is like that, I'm trying to copy my *.scss file…
d.g
  • 51
  • 1
  • 5
2
votes
1 answer

Using ES6 and let/const with export / import and Karma/webpack - export at the top

export { test }; const test = (str) => { return str; }; import { test } from './func'; describe('func', () => { describe('func', () => { it('should return the same string', () => { expect(test('hello…
jBoive
  • 1,219
  • 1
  • 14
  • 40
2
votes
0 answers

Why is Karma starting my complete React App when unit testing a single utils function?

I am trying to use Karma to test my React JS app. However, it get all kind of errors because it is trying to load/start the complete app. My first error was Invariant Violation: _registerComponent(…): Target container is not a DOM element …
edbras
  • 4,145
  • 9
  • 41
  • 78
2
votes
0 answers

WebStorm + Webpack + Karma - Unable to debug

I've searched through what seems like all of the questions in the [webpack] category, but to no avail. The following did not work: Karma + Webpack + sourcemap preprocessor doesn't stop at breakpoints in WebStorm webpackJsonp not defined using…
Nava2
  • 437
  • 3
  • 16
2
votes
0 answers

karma+webpack+typescript+mocha require is not defined

I try to configure my environment to run tests on node. This my my webpack.config.test.js const serverConfig = { module: { loaders: [ {test: /\.tsx?$/, loader: 'ts-loader' } ] }, target: 'node', …
Kevin AB
  • 543
  • 1
  • 4
  • 8
2
votes
0 answers

Karma-webpack+angular TypeError: undefined is not an object (evaluating '$httpBackend.expectPOST'

I got the following error PhantomJS 2.1.1 (Linux 0.0.0) leave API service create(): should create a leave FAILED static/app.min.js:4804:54 forEach@static/app.min.js:440:25 loadModules@static/app.min.js:4764:13 …
Édouard Lopez
  • 40,270
  • 28
  • 126
  • 178
2
votes
0 answers

awesome-ts-loader doesn't correctly process files when loaded through karma-webpack

I have an Angular 2 application that is bundled with Webpack, and tested with Jasmine through Karma with karma-webpack. When developing, the code is bundled and served correctly. When testing, awesome-ts-loader throws a "Module parse failed" error…
kyleburke
  • 269
  • 4
  • 8
2
votes
0 answers

karma-webpack not generating es5 code

When I run tests in phantom, I get the following error: PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR SyntaxError: Unexpected token 'const' When I inspect the test js file that is generated by webpack, it indeed has const declarations despite the…
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
2
votes
1 answer

Remap Istanbul incorrect coverage report

Running a react redux app with typescript i get incorrect coverage results when running karma webpack with istanbul-remap for mapping back to typescript source code. For example i added a change to a react unit test that makes the code not go into…
radix
  • 795
  • 1
  • 5
  • 16