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
1
vote
1 answer

How to test in Karma without require.context

So I spent a long time in React land, with Jest as my test runner/environment. Flash forward to new job, and we're unit testing an Angular 8 app w/ Karma. Much to my dismay, I come to find the default config for Angular, and every single guide out…
Jon Jaques
  • 4,262
  • 2
  • 23
  • 25
1
vote
0 answers

Importing service using Ionic-Angular causes Karma test suite to fail

I am having trouble with my Karma tests. I am trying to import a service which makes use of an object within the Ionic-Angular package. Whenever I try to run npm test to start up the test suite, it compiles fine, however after that I am being…
1
vote
1 answer

Karma with Webpack: Istanbul coverage is 100%(0/0)

I am trying to implement code coverage functionality for Angular 1.6.6 app with Webpack (4.27.1) and Karma(3.1.3) + Jasmine(jasmine-core 2.99.1). All tests pass successfully. However Istanbul(0.4.5) code coverage result displays 100%(0/0) Test…
user9876776
1
vote
2 answers

Karma showing this error TypeError: Cannot read property 'textContent' of undefined

I am writing a very basic unit test. I don't know what to do with it. I have tried so many things but cannot be able to resolve this error. Except first test other test is failing. Spec file fdescribe("New TestOrder ICD10 Code Selection Modal…
1
vote
0 answers

Problem in Coverage with Karma / Webpack / Istanbul

perhaps you can help me out. Im not a big expert with karma so perhaps I miss something. My Project looks like this: js/libs --> Saved all libs I need js/src/[ComponentName] --> Saved all custom scripts in own component folders Within the…
1
vote
0 answers

Angular 6 Unit testing : Empty test suite

Under my Angular 6 app i'm using karma for unit testing , this is my config : // Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html module.exports = function (config) { …
firasKoubaa
  • 6,439
  • 25
  • 79
  • 148
1
vote
0 answers

Importing scss files failes during tests

I'm trying to import scss files in Vue component: It works fine on dev and prod build (npm run dev, npm run build), however, it fails (Invalid CSS after "...load the styles":…
1
vote
1 answer

How can I get karma-webpack to respect declared loaders?

I’d like a sanity check. I’m running tests on a bunch of web components using karma + webpack (so karma-webpack). The app itself compiles and all those things perfectly fine. But when I try to do the same things via karma-webpack (using the same…
1
vote
0 answers

Karma Webpack error - path" argument must be of type string

I'm trying to add Karma to a project and failing at the webpack step. When I try configure webpack to be called by Karma I get an error: 07 09 2018 13:52:41.487:ERROR [karma]: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type…
TobyGWilliams
  • 631
  • 1
  • 5
  • 17
1
vote
1 answer

karma-coverage includes node_modules

I have a karma config which for my unit test and code-cov. My project dir looks like below RootFOlder -karma.config.js -webpack.test.config.js -src/ --test.ts --components ---ButonComponent ----Buttoncomponent.spec.ts And my karma.config is…
Nuru Salihu
  • 4,756
  • 17
  • 65
  • 116
1
vote
1 answer

RangeError: Invalid string length on angular cli karma

Karma crashes with the above error. Even with a brand new angular cli project. { "dependencies": { "@angular/animations": "^4.2.4", "@angular/common": "^4.2.4", "@angular/compiler": "^4.2.4", "@angular/core": "^4.2.4", …
s.Lawrenz
  • 302
  • 3
  • 17
1
vote
1 answer

How would I unit test this simple jQuery code with karma/jasmine?

I'm working on creating a webpack starter app for to support lightweight Typescript and jQuery development. So far it's working out well, doing all the cool stuff I want it to do like automatically detecting edits, rebuilding and relaunching the app…
kshetline
  • 12,547
  • 4
  • 37
  • 73
1
vote
1 answer

AngularJS Karma check url param is present

I'm new to unit testing and trying to write a unit test for my app. My Route is : { name: 'details', url: '/accounts/company/:companyId', controller: 'controllere', templateUrl: 'templateurl', } My Controller : if…
pkdq
  • 191
  • 1
  • 14
1
vote
1 answer

@Input decorator and Karma tests

After excluding some components' parts into smaller UI-components I assigned them properties which are passed from parent and got with help of @Input() decorator. But it looks like Karma doesn't understand these Inputs and throws me errors…
Sergey
  • 7,184
  • 13
  • 42
  • 85
1
vote
0 answers

Configuring unit testing within an Ionic3 application

I'm implementing unit tests within an ionic3 project based on the following sample project: https://github.com/ionic-team/ionic-unit-testing-example. It works fine but I have some issues: I can see compilation errors (for jasmine) whereas these…
Thierry Templier
  • 198,364
  • 44
  • 396
  • 360