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

Redux + karma-webpack - cannot read displayName of undefined upon import of React.Component

I'm using karma-webpack and I am refactoring a React Component to use in multiple places. I moved the component to it's own file, so I can import it and connect it differently by applying mapStateToProps / mapDispatchToProps in the HOC I later…
zedd45
  • 2,101
  • 1
  • 31
  • 34
2
votes
0 answers

Can't find nodes with enzyme and css-modules when using karma-webpack

I've been using css-modules with mocha, enzyme and css-modules-require-hook without any problems. Foo.js import React from 'react'; import styles from './Foo.css'; const Foo = () =>
Foo component
; export default…
qmmr
  • 502
  • 1
  • 5
  • 17
2
votes
1 answer

Failing to run tests using Karma

I am setting up Karma to simplify unit tests in a legacy project. The problem is, I am getting an error You need to include some adapter that implements __karma__.start method!. As I have found, this is a very non-specific error, so I am at a loss…
azangru
  • 2,644
  • 5
  • 34
  • 55
1
vote
0 answers

Run Angular tests without the CLI?

Given a typical Angular CLI generated project, I'd like to run tests without the CLI (because big-business). I'd like to initiate karma using the Karma CLI. I am using Angular 16. With my setup, I'm currently getting Incomplete: No specs…
spots
  • 2,483
  • 5
  • 23
  • 38
1
vote
0 answers

__webpack_require__ error in angular project when running karma/jasmine

I have this error, following a few minor update. I just have update a few angular stuff, but I don't know what I have to fix in my karma.config to fix it. The fun part is, I don't have any config of webpack anywhere. An error was thrown in…
sab
  • 4,352
  • 7
  • 36
  • 60
1
vote
0 answers

PhantomJS 2.1.1 ERROR: SyntaxError: Functions cannot be declared in a nested block in strict mode

PhantomJS 2.1.1 (Windows 8) ERROR SyntaxError: Functions cannot be declared in a nested block in strict mode at :/Users/AppData/Local/Temp/_karma_webpack_149363/commons.js:58529:0 Does anyone know where I could start trying to figure out this…
nerz
  • 337
  • 1
  • 5
  • 13
1
vote
0 answers

Uncaught Error: Property icon is required for fa-icon/fa-duotone-icon components. at http://localhost:9876/_karma_webpack_/polyfills.js:23598:29

I am running my test case in the project. I am facing below error when test cases are executing. Although they are not breaking my test case but still printing lots of logs in the console. I am working on Angular v11. Chrome 88.0.4298.0 (Windows 10)…
1
vote
0 answers

When I am running npm run test in my Angular project, I get this RangeError:

Chrome Headless 89.0.4389.114 (Windows 10) ERROR Uncaught RangeError: Maximum call stack size exceeded at localhost/karma_webpack/node_modules/zone.js/dist/mocha-patch.js I tried a lot of things, even adding include:false in files section from…
Corina
  • 11
  • 1
1
vote
0 answers

Why are Karma tests failing after moving to Webpack 5?

I have a set of karma tests which were passing with webpack v4.46.0 but they fail because of spyOn after moving to webpack v5.0.0. A lot of tests spy on a module as follows: import Module from '...'; ... beforeEach(() => { spyOn(Module,…
1
vote
1 answer

Karma webpack compiled but not executed

I am running javascript tests with functionality compiled by webpack in Karma. It seems that sources are compiled but not processed by karma, no test run. testing.webpack.js module.exports = { devtool: 'inline-source-map', resolve: { …
Victor Shelepen
  • 1,966
  • 2
  • 16
  • 41
1
vote
0 answers

Test host component always gives spurious "not a known element" error, might be karma-webpack issue?

I'm trying to use the test host pattern described in the Angular docs, where you create a super lightweight component in your spec whose template is a literal that just includes the component under test. @Component({ selector: "simple-test", …
Coderer
  • 25,844
  • 28
  • 99
  • 154
1
vote
1 answer

Webpack directory appended at error after migrating to Angular9

I've recently upgraded my projet from angular 7 to angular 9. When I run the tests (ng test), I always get http://localhost:9876/_karma_webpack_/ appendend to the error, hence in visual studio code, we can't click on the error to got directly to the…
JFPicard
  • 5,029
  • 3
  • 19
  • 43
1
vote
2 answers

Docker (node:8.15-alpine) + Chromium + Karma unit tests not working

I'm trying to run my frontend tests on Docker (node:8.15-alpine) using Chromium and Karma, however I'm getting lots of ChromeHeadless related errors. These tests used to work but recently they suddenly stopped, so I'm guessing it's either related to…
1
vote
0 answers

Corresponding Webpack commands for each ng command in Angular8

For some reason the ng build, ng test and ng lint or I would say all ng commands are not allowed in our pipeline. So I am googling to know the corresponding webpack commands for each ng command in Angular8. Angular-cli 7 has the feature to do ng…
1
vote
0 answers

Karma $filter Error: [$injector:unpr] Unknown provider: nProvider <- n

I'm in the process of updating our external AngularJS module. Once I updated our Webpack and Karma-Webpack, I started getting this unknown provider error. I wish I could use ng-strict-di, but when I add this into our application, everything works…