Ok, I resolved this issue after finding a random github issue. My Karma test-main.js file loaded tests and ran a callback like so:
var tests = Object.keys(window.__karma__.files).filter(function (file) {
return /Spec\.js$/.test(file);
});
requirejs.config({
// ... more code here
// ask Require.js to load these files (all our tests)
deps: tests,
// start test run, once Require.js is done
callback: function () {
mocha.setup('bdd');
mocha.ignoreLeaks();
mocha.run();
}
});
Now instead of defining deps and callback in the requirejs.config
, I added the following code at the end of test-main.js:
// load all tests
require(tests, function () {
// start test run once requirejs is done
mocha.setup('bdd');
mocha.ignoreLeaks();
mocha.run();
});
And everything works swimmingly again! Big thanks to @FabienDeshayes on GitHub for this.