karma-jspm
karma-jspm copied to clipboard
karma.error is not a function
When I try and load up a module that has an incorrect path for an import
, the promiseChain
inside the karma-jspm/src/adapter
fails (as it should). However, in the catch statement, on line 63, the call to karma.error
is made, trying to error out a message. However, karma.error
does not exist on the karma
object, causing all the testing to shut down instead of failing on just that test.
Example test:
import PackageFactory from 'factories/InboxPackage';
describe('the test module', () => {
it('is running tests', () => {
expect(true).toBe(true);
});
});
Error:
system.src.js:1085 GET http://localhost:9876/factories/InboxPackage.js 404 (Not Found)fetchTextFromURL @ system.src.js:1085(anonymous function) @ system.src.js:1646init @ system-polyfills.src.js:446Promise @ system-polyfills.src.js:434(anonymous function) @ system.src.js:1645(anonymous function) @ system.src.js:2667(anonymous function) @ system.src.js:3239(anonymous function) @ system.src.js:3506(anonymous function) @ system.src.js:3888(anonymous function) @ system.src.js:4347(anonymous function) @ system.src.js:4599(anonymous function) @ system.src.js:337tryCatchReject @ system-polyfills.src.js:1252runContinuation1 @ system-polyfills.src.js:1211Fulfilled.when @ system-polyfills.src.js:999Pending.run @ system-polyfills.src.js:890Scheduler._drain @ system-polyfills.src.js:166Scheduler.drain @ system-polyfills.src.js:131run @ system-polyfills.src.js:337
system-polyfills.src.js:209 Potentially unhandled rejection [4] TypeError: karma.error is not a function
at http://localhost:9876/base/node_modules/karma-jspm/src/adapter.js:63:19
at tryCatchReject (http://localhost:9876/base/wwwroot/jspm_packages/system-polyfills.src.js:1252:30)
at runContinuation1 (http://localhost:9876/base/wwwroot/jspm_packages/system-polyfills.src.js:1211:4)
at Rejected.when (http://localhost:9876/base/wwwroot/jspm_packages/system-polyfills.src.js:1032:4)
at Pending.run (http://localhost:9876/base/wwwroot/jspm_packages/system-polyfills.src.js:890:13)
at Scheduler._drain (http://localhost:9876/base/wwwroot/jspm_packages/system-polyfills.src.js:166:19)
at Scheduler.drain (http://localhost:9876/base/wwwroot/jspm_packages/system-polyfills.src.js:131:9)
at MutationObserver.run (http://localhost:9876/base/wwwroot/jspm_packages/system-polyfills.src.js:337:4)(anonymous function) @ system-polyfills.src.js:209report @ system-polyfills.src.js:236flush @ system-polyfills.src.js:258
Code that is failing:
//adapter.js: line 50
// Load everything specified in loadFiles in the specified order
var promiseChain = Promise.resolve();
for (var i = 0; i < karma.config.jspm.expandedFiles.length; i++) {
promiseChain = promiseChain.then((function (moduleName) {
return function () {
return System['import'](moduleName);
};
})(extractModuleName(karma.config.jspm.expandedFiles[i])));
}
promiseChain.then(function () {
karma.start();
}, function (e) {
karma.error(e.name + ": " + e.message); // <--- This is the line that is causing the error.
});
Hi, which version of karma are you using?
I am using karma version 0.13.22 karma-jspm is version 2.1.1
Same here.
On Tue, Jun 14, 2016 at 3:05 PM, Andrew Stoker [email protected] wrote:
I am using karma version 0.13.22 karma-jspm is version 2.1.1
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Workiva/karma-jspm/issues/157#issuecomment-225983977, or mute the thread https://github.com/notifications/unsubscribe/ABdsPLdUEUHknhpibc2-jU12KtM33Xg7ks5qLvtogaJpZM4IsiQs .