Questions tagged [karma-mocha]

karma-mocha is a Karma plugin. Adapter for Mocha testing framework.

karma-mocha is A Karma plugin. Adapter for Mocha testing framework.

325 questions
3
votes
1 answer

Test Angular directive with templateUrl and Jade

I'm using Node.js with Express and Jade in my web application, with AngularJS on top. Usually, when I build directives, I include Html in the template of the directive definition, and then I test the directive writing the Html snippet I need. But…
napcoder
  • 465
  • 1
  • 4
  • 14
2
votes
0 answers

Unit Tests not running after Chrome 83 Update

I updated Chrome from 81 to 83. Prior to that update all of my Karma unit tests were passing successfully. Now, my HeadlessChrome unit tests are failing because Chrome never connects. Has anyone ran into this issue? I am currently on a Windows 10…
2
votes
0 answers

Vue-cli 3 how to integrate karma?

What problem does this feature solve? karma Unit Testing What does the proposed API look like? Vue-cli 3 integration karma Karma can't get the mode defined in vue-cli 3 Below is my karma.conf.js const path = require('path') const webpackConfig =…
freedom
  • 110
  • 2
  • 11
2
votes
1 answer

Test void with karma jasmine angular2

I'm trying to test my code with jasmine and karma. When I test a method that returns a value it's ok. But my problem is how can I test a void method (that return nothing) for example this one: public aj(a: Array, p: x) { if (a.indexOf(p) < 0)…
thouraya
  • 135
  • 2
  • 11
2
votes
0 answers

Issue with running 'npm test' on windows 10

I have units tests for js code. I try to run them on Windows 10 with command: npm test It throws error as: .......\node_modules.bin\karma:2 basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')") ^^^^^^^ SyntaxError: missing ) after…
Mandroid
  • 6,200
  • 12
  • 64
  • 134
2
votes
1 answer

can I test angular app by mocha and Chai?

I'm working on a project with Node.js/angular4 and I'm newbie on testing so my question is if it's possible to test angular by mocha and chai because it come by default by jasmine so if yes. can you tell me how ?
Dev
  • 125
  • 2
  • 15
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

Typescript UnitTests with Karma and Mocha

I'm trying to implement unit tests for my code by using Karma + karma-typescript + mocha. The following code is based on this example. The only differences are that I use mocha instead of jasmine and amd instead of commonjs. The directory…
2
votes
1 answer

Error: More than one instance of library found

I'm importing bitcore-mnemonic in my React project with this conditions: I'm importing it just once and in one file. The component utilising it is imported just once and is called by react-router. No other library is using bitcore-lib. How…
Reyraa
  • 4,174
  • 2
  • 28
  • 54
2
votes
1 answer

Can I get Mocha to not show passed tests?

We just started unit testing at work using Mocha and Karma. We have less than 100 tests, and having to sift through all the passed tests to find the failed ones is already cumbersome. I can't imagine what it'll be like when we have thousands of…
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 mocha not recognizing JSX code

I am attempting to add automated testing to a react application using karma and mocha. The application is written using ES6 and JSX so I am also using webpack. I have imported the webpack config into the karma configuration settings, but I am still…
zak
  • 21
  • 2
2
votes
0 answers

Setup Testing with Karma Mocha Webpack2 Typescript

I'm trying to setup testing in my custom Webpack 2 boilerplate with Karma, Mocha and Chai. In the project I'm using Typescript 2, so package.json has following structure: "scripts": { ... "test": "NODE_ENV='test' karma start karma.conf.js" …
lomboboo
  • 1,221
  • 1
  • 12
  • 27
2
votes
0 answers

Webpack + Karma + Mocha: How do I use real XmlHttpRequest in Mocha tests?

Problem I'm trying to test TypeScript code that uses XMLHttpRequest. When running the whole Karma test suite from the IDE, the test passes because it opens a browser and gets the XmlHttpRequest and DOM libraries provided. For reference, here is the…
Jamie Birch
  • 5,839
  • 1
  • 46
  • 60
2
votes
1 answer

How to properly unit test ReactDOM.render with Karma and PhantomJS?

Say I have the following on Index.tsx: ReactDOM.render(

Hello World

, document.getElementById("wrapper") ); First, how exactly do I unit test ReactDOM.render call? Second, running this on Karma +…
rfgamaral
  • 16,546
  • 57
  • 163
  • 275