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

Can not load reporter "coverage-istanbul"

I am trying to run code coverage using https://webpack.js.org/loaders/istanbul-instrumenter-loader/ Here is the karma.conf.js var testWebpackCfg = require('../webpack/webpack.config.test.js'); module.exports = function(config) { config.set({ …
Nishant
  • 1,034
  • 9
  • 19
4
votes
4 answers

Cannot read property 'externalModuleIndicator' of undefined while running unit test using karma and webpack 4

After upgrading my angular project with webpack 4 I am getting below error while running unit test using karma [at-loader] Using typescript@2.7.2 from typescript and "tsconfig.json" from demo-app-app\src\tsconfig.json. [at-loader] Checking…
raoul.nair
  • 389
  • 1
  • 8
  • 21
4
votes
1 answer

How to include vendor bundles from webpack for use in karma test runner

I have an AngularJS 1.x project written in TypeScript and am using Webpack. I am now trying to setup the karma-typescript module with an example test I have written for one of my services. I followed the sample karma config file from here, so have…
mindparse
  • 6,115
  • 27
  • 90
  • 191
4
votes
0 answers

Karma coverage always 0/0

So I have 1 spec.ts file with 3 tests. Tests work well: HeadlessChrome 0.0.0 (Windows 7 0.0.0): Executed 3 of 3 SUCCESS (0.255 secs / 0.027 secs) But coverage always show 0/0: =============================== Coverage summary…
rjsm
  • 41
  • 1
4
votes
0 answers

I think Karma is running tests twice

I am trying to test my react app using karma(on PhantomJS2), jasmine, and enzyme. I have noticed that some of my tests are failing. It seems to be because each it block is being called twice(I have confirmed this by putting prints in all my it…
4
votes
2 answers

No Angular source maps in Karma DEBUG RUNNER

Since recently upgrading to the latest angular-cli and angular, I no longer see source-maps in the Chrome Karma debug runner. Having done a bit of research I came across the ng test --sourcemaps=true option but that has made no difference, there is…
jenson-button-event
  • 18,101
  • 11
  • 89
  • 155
4
votes
0 answers

Why is webpack outputting the const keyword instead of var?

Webpack appears to be outputting the const keyword instead of the var keyword which is breaking PhantomJS (as it doesn't support ES6 syntax). ... /* 2 */ /***/ function(module, exports, __webpack_require__) { "use strict"; const…
Matt Searles
  • 2,656
  • 2
  • 16
  • 18
3
votes
0 answers

Custom webpack configuration for angular karma tests not resolving Components but works for Directives

I made custom webpack config for angular karma and when starting tests, getting this message for each test with @Component decorator: TypeError: Cannot read property 'ɵcmp' of undefined at getComponentDef…
Andrey
  • 311
  • 2
  • 8
  • 29
3
votes
0 answers

Karma testing and headlessChrome fail when I try to test webcomponents that import external css files (import css from "styles.css")

I am trying to test a webcomponent created with lit-element. I am using open-wc with karma for testing. My webcomponent file imports a css file that will be injected in the webcomponent class. If I import any css file in the component, the test of…
3
votes
0 answers

Can't import class in Karma.js with Typescript, Webpack

I have been trying to get Karma.js working with my very basic test suite. The site works in a browser so the code itself is fine. I have had a few issues but this one I cant solve even after hours of effort. This is my test file - if I uncomment the…
3
votes
1 answer

Can not load "webpack", it is not registered! Perhaps you are missing some plugin?

ERROR [preprocess]: Can not load "webpack", it is not registered! Perhaps you are missing some plugin? Webpack version: 4.14.0 Webpack Karma version: 2.0.4 Karma version: 3.0.0 Linux module.exports = ( config ) => { config.set( { …
Ever Sadia
  • 31
  • 1
  • 4
3
votes
0 answers

ERROR when trying to run karma test

I am having problems to setup karma with Angular 5.2.0 (without Cli) The Angular application is working, but the problem is with karma, when I try to run the test i get this ERROR: karma start Hash: ccc4545dd1d9416a823b Version: webpack 3.10.0 …
n3tx
  • 429
  • 2
  • 10
  • 23
3
votes
0 answers

Karma unit test error: You may need an appropriate loader to handle this file type

I'm trying to make some unit tests using Karma and Jasmine in Typescript (Angular 4). The project that i'm working on is mostly done by others (I'm doing my internship at a company), and i developed only a small part of it. The thing is that i need…
3
votes
0 answers

How to load raw html in karma using webpack

I have an app compiled using webpack that loads html files using require thanks to the following bit of configuration in webpack.config: module: { rules: [ { test: /-view\.html$/, use: 'raw-loader' } …
nourdine
  • 7,407
  • 10
  • 46
  • 58
3
votes
1 answer

How to add Karma+Mocha tests after initializing project using vue-cli

Hi I started a project using Vue-cli webpack the mistake I did was I did not enable tests How do I add karma+mocha to my webpack vuejs2 development is it possible to reinitialize and include tests ?
f4r4
  • 563
  • 8
  • 19
1
2
3
11 12