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
5
votes
0 answers

Debug on Visual Studio Code Karma + Webpack + Chrome Debugger

I'd like to debug on Visual Studio Code some tests that run on the following stack: Typescript + Karma + Mocha + Chai + Webpack + Chrome Debugger Extension. Problem: It never reaches the breakpoints. If I restart the test (from the green arrow), it…
5
votes
1 answer

ERROR: '[Vue warn]: Failed to resolve directive: in testing

I am writing unit tests in a Vue 2.0 app using PhantomJS, Karma, Mocha and Chai and while the tests pass, I get a warning with each test that looks like this: ERROR: '[Vue warn]: Failed to resolve directive: highlightjs (found in ) I…
5
votes
0 answers

Karma tests pass in watch mode, but fail when --single-run flag is passed

I'm trying to update a Node.js library to also work in browsers. I have a large number of tests that all work as expected in Node.js but are giving me a number of issues when I try to run them in a browser (via Karma & Browserify). One particular…
Nathan Friedly
  • 7,837
  • 3
  • 42
  • 59
5
votes
2 answers

Mocha tests using Immutable.js are failing when runned with Karma

here is some context. I'm working on a project using React and Immutable.js, written with ES6. I use Babel and webpack. I wrote some unit tests using Mocha, Chai and jsdom so they could be executed outside a browser. The problem is that some of the…
5
votes
1 answer

Karma coverage fails to show correct results

I need some help regarding Karma with browserify coverage. I created a repo with the test I am running in here: https://github.com/jotaoncode/web-istanbul The results on my coverage are the following: Results of coverage The test only runs over the…
juan garcia
  • 1,326
  • 2
  • 23
  • 56
5
votes
1 answer

Setting up karma, chai, requirejs, chai-jquery

I'm close to getting our tests to run with Karma but I'm missing the last step (I think), getting chai-jquery to behave, I've tried two different plugins https://www.npmjs.com/package/karma-chai-jquery and…
leopic
  • 2,958
  • 2
  • 27
  • 42
5
votes
2 answers

chai is not defined in Karma-mocha

I am running my test cases succesfully using mocha-phantomjs configurations. Now I am running these test using Karma launcher. But I get the issue Chai is not defined. Here is my configuration file. module.exports = function(config) { …
ankitr
  • 5,992
  • 7
  • 47
  • 66
4
votes
0 answers

Karma-typescript cannot find module "readable-stream/duplex.js"

The closest thing I have found here is karma-typescript cannot find module but that one refers to an issue where karma-typescript cannot find a source file not a dependency. Its solution didn't work anyway. I am trying to set up unit testing for a…
4
votes
0 answers

Single File Vue Component Tests Won't Run if Style is Tag is in File

I am using chai, mocha, karma and vue-test-utils to test my vue components. After a lot of investigation I have found that tests only run when there is no style in the single file component. There are no errors or anything the test files cimply get…
bilcker
  • 1,120
  • 1
  • 15
  • 43
4
votes
1 answer

Weird wei to ether conversion using web3

I am trying to do some gas transaction cost calculations in a karma test to assert the final balance and I can not understand why the output of this two code snippets is different Values for variables in order are: 59916559960000000000…
Carlos Landeras
  • 11,025
  • 11
  • 56
  • 82
4
votes
0 answers

Karma-babel require is not defined, even when not using require

I have this: import assert from 'assert'; import foo from './foo'; describe('Array', function() { but when running karma I get the error require is not defined even when not using require. any ideas? module.exports = function (config) { …
SuperUberDuper
  • 9,242
  • 9
  • 39
  • 72
4
votes
3 answers

karma - Cannot find plugin

I am trying to run js test cases using karma. But Always getting plugin not found error. And funny part is the same config file, working fine for other co-worker of mine Here is logs : $ karma start karma.conf.js 04 10 2016 17:51:24.755:ERROR…
Aniruddha
  • 3,513
  • 6
  • 27
  • 38
4
votes
2 answers

Angularjs unit testing - ng-disabled not working when adding text to textarea

I am trying to test an AngularJS component using karma, mocha, power-assert. I have a textarea and a button in my component, where the button is disabled based on the length of text in textarea. When I run the component in browser it works…
user6573907
4
votes
0 answers

Karma + PhantomJS - window is not defined

I am using Karma and PhantomJS for a headless browser. For some reason, I keep getting an error saying window is not defined. My karma.conf.js var path = require('path'); var webpack = require('webpack'); var webpackConfig =…
4
votes
2 answers

Clear stdout before `mocha --watch` re-runs

I'd like to automatically execute clear between each test iteration with mocha --watch. Is there a nice way to automatically execute a command before (re)running mocha?
Ashley Coolman
  • 11,095
  • 5
  • 59
  • 81
1 2
3
21 22