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
23
votes
3 answers

Karma Webpack sourcemaps not working

I'm using Karma-Webpack to run my Angular 2 specs. https://github.com/webpack/karma-webpack When I execute tests using karma in Chrome, the source files for my specs appear readable in the debugger. However, the system under test files (my…
Ryan Langton
  • 6,294
  • 15
  • 53
  • 103
21
votes
3 answers

Karma webpack outputting multiple "webpack: wait until bundle finished"

After the recent releases of webpack 1.14.0 / karma 1.4.0 / karma-webpack 2.2.0, that I now see a lot of these messages when karma starts its webpack build. webpack: wait until bundle finished: Sometimes I see as many as 6-8 of them and they seem…
Kim Gentes
  • 1,496
  • 1
  • 18
  • 38
13
votes
3 answers

angular-cli - Use multiple karma.conf.js

I am using angular-cli and I want to use two karma.conf.js files for testing. For CI : For which I am using Headless Chrome customLaunchers: { ChromeHeadless: { base: 'Chrome', flags: [ '--headless', '--disable-gpu', //…
9
votes
1 answer

Jasmine Karma fails with 'ReferenceError: process is not defined'

I recently updated from Angular9 to Angular 12. After the update my tests have started "failing". I have quotes around that because the tests themselves seems to be fine, however after every run there is an "Error" entry that is not very…
kewur
  • 421
  • 5
  • 15
8
votes
1 answer

Karma not running tests that have "import" statements in karma-webpack

I have some test files with tests I'd like to run against my app. I am attempting to use karma, karma-webpack, karma-babel-preprocessor, karma-chrome-launcher, and jasmine in my testing. My app depends on many things, including backbone,…
Caleb Jay
  • 2,159
  • 3
  • 32
  • 66
6
votes
2 answers

Karma + Ionic 4 - No value accessor for form control with name

I would like to know how to implement unit form tests with karma. I've implemented a test but it always gives the following error: Error: No value accessor for form control with name: 'email' signup.module.ts import { NgModule } from…
Renan Gueiros
  • 211
  • 2
  • 6
6
votes
2 answers

Karma Test With angular 6

I am tring to run test of angular using npm ng test but the problem is that chrome start and not stop after test finish so I used : ng test --watch=false but that cause error "Chrome 69.0.3497 (Linux 0.0.0) ERROR" which make chrome timeout I am…
Mohamed Adel
  • 1,980
  • 17
  • 23
6
votes
1 answer

Angular TestBed fails with Webpack, Karma/Jasmine

I tried to use Angular TestBed as described on angular.io website to test a simple component, but I get errors like: TypeError: undefined is not an object (evaluating 'ProxyZoneSpec.assertPresent') and 404 as it cannot load the external component…
Francesco
  • 9,947
  • 7
  • 67
  • 110
5
votes
0 answers

Ignoring coverage on typescript decorators

I'm using Typescript to create some web components with Lit element. Webpack to bundle and unit tests with karma. I've noticed that the coverage report is all out: showing uncovered branches and statements on decorators coverage for lines following…
albert
  • 163
  • 1
  • 5
5
votes
1 answer

karma-webpack plugin: where does the bundle file go?

I am using Karma with the karma-webpack plugin for bundling and transpiling with babel. When a test has an error, I get a nice message with a line number for the bundle, like the following: Service: DocumentService ✗ gets the correct number of…
mhatch
  • 4,441
  • 6
  • 36
  • 62
5
votes
1 answer

Sourcemapping TypeScript in Karma

I'm trying to set up a build process for TypeScript using Webpack. Everything's working fine for most parts. However I can't get source-maps to work properly in the Karma test runner. Problem description Let's say I have a typescript file…
kremerd
  • 1,496
  • 15
  • 24
5
votes
1 answer

Module build failed: SyntaxError: 'import' and 'export' may appear only with 'sourceType: "module"'

When running tests with code coverage through angular-cli (ng test -cc), karma throw the error below. The culprit seems to be the istanbul code coverage module as running the tests without -cc does not result in any errors. Error (I've replaced…
shmow
  • 622
  • 1
  • 8
  • 19
5
votes
1 answer

karma-webpack not loading AngularJS bundle

I recently started the move from a custom gulp script that used to take care of all sorts of stuff to webpack. I have it working to a point where transpiling, bundling and serving the client app in the browser works great. Now, when I was using…
tkit
  • 8,082
  • 6
  • 40
  • 71
5
votes
0 answers

Jasmine, Karma: fetch-mock not working

I am trying to mock Fetch in Jasmine/Karma test using fetch-mock But it is not working, seems that fetch-mock does not mock the request. I tried to set up the polyfill codes, but the result is the same. Is there something we have to set up before…
4
votes
2 answers

Karma throws "Module parse failed" when reading typescript

Repo with an example: https://github.com/OriolInvernonLlaneza/karma-webpack-error-example I had Karma + Jasmine tests running correctly with Angular 11 and Webpack 4. However, when trying to update Angular and Webpack to v12 and v5, I'm getting…
Oriol_IL
  • 120
  • 1
  • 14
1
2 3
11 12