Closed kwhitaker closed 8 years ago
Did never test with browsers: [ 'jsdom' ]
. Could you put your project configuration (including example test cases) somewhere on GitHub for inspection?
I don't think jsdom
is the culprit. I swapped it for PhantomJS
and got a similar error spew, starting with
09 03 2016 07:11:58.876:ERROR [framework.browserify]: bundle error
09 03 2016 07:11:58.876:ERROR [framework.browserify]: Error: Cannot find module './lib-cov/mocha' from '/Users/kevinwhitaker/code/wheel-test/node_modules/mocha'
The karma configuration is above. Here's the code being tested:
class Greeting {
constructor(name) {
this.name = name || 'Guest';
}
hello() {
return `Welcome, ${this.name}!`;
}
}
export default Greeting;
import {describe, it} from 'mocha'
import {expect} from 'chai'
import Greeting from './Greeting'
describe('Greeting', () => {
it('Can say hello', () => {
const greeting = new Greeting()
const message = greeting.hello()
expect(message).to.be.equal('Welcome, Guest!')
})
})
and the script to execute:
"./node_modules/karma-cli/bin/karma start karma.conf.js --no-auto-watch --single-run"
Your logs tell you about a bundle error, too:
07 03 2016 08:37:02.006:ERROR [framework.browserify]: bundle error
07 03 2016 08:37:02.006:ERROR [framework.browserify]: Error: Cannot find module './lib-cov/mocha' from '/Users/kevinwhitaker/code/wheel-test/node_modules/mocha'
07 03 2016 08:37:02.010:INFO [karma]: Karma v0.13.21 server started at http://localhost:9876/
Did you try to remove coverage testing and see if it works without?
And please specify the version of karma-browserify you are using.
Some comments based on similar problems i'm having.
Not sure if this is usefull :-)
Closing this for now.
I've searched through the issues listed here (and on Google), but none of the solutions presented fix my issue. When attempting to run my mocha tests, I get an error spew about finding modules.
Here's the spew:
and my
karma.conf.js
:I've tried it with and without the shim, changed browsers, etc. I'm running on OS X, btw.