Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

karma.error is not a function #157

Open
AStoker opened this issue Jun 2, 2016 · 3 comments
Open

karma.error is not a function #157

AStoker opened this issue Jun 2, 2016 · 3 comments

Comments

@AStoker
Copy link

AStoker commented Jun 2, 2016

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.
        });
@maxwellpeterson-wf
Copy link
Contributor

Hi, which version of karma are you using?

@AStoker
Copy link
Author

AStoker commented Jun 14, 2016

I am using karma version 0.13.22
karma-jspm is version 2.1.1

@tamird
Copy link

tamird commented Jun 14, 2016

Same here.

On Tue, Jun 14, 2016 at 3:05 PM, Andrew Stoker notifications@github.com
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
#157 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABdsPLdUEUHknhpibc2-jU12KtM33Xg7ks5qLvtogaJpZM4IsiQs
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants