karma, when run via intelliJ, crashes when using karma-typescript plugin.

I'm using https://github.com/monounity/karma-typescript to test a typescript npm module. It's more or less the only plugin that seems to do everything right out of the box without the necessity to set up 20 other plugins to do the same job in a quirky way.

Using the default configuration it's running perfectly fine via cmd `karma start`. All sources are compiled,tests are executed nicely and reports get generated, line coverage seems to be fine etc. etc.

When run via intelliJ it will crash:

    ```TypeError: Cannot read property 'push' of undefined
    at C:\git\ts-http-client\node_modules\karma\lib\reporters\multi.js:6:24
    at Array.forEach (native)
    at MultiReporter.addAdapter (C:\git\ts-http-client\node_modules\karma\lib\reporters\multi.js:5:15)```

This issue pops up during the "initialising tests" stage and only happens when run via IntelliJ. My code is compiled to ES6. Karma uses es6-shim to behave. The issue is happening with all reporter combinations i tried out.

my karma.config.js

module.exports = function (config) {
config.set({

frameworks: ["karma-typescript", "jasmine"],

files: [
"node_modules/es6-shim/es6-shim.js",
{pattern: "src/**/*.ts"},
{pattern: "test/**/*.ts"}
],

preprocessors: {
"src/**/*!(\.d).ts": ["karma-typescript"],
"test/**/*!(\.d).ts": ["karma-typescript"]
},

karmaTypescriptConfig: {
compilerOptions: {
target: "ES6"
},
excludeFromCoverage: /(\.d|\.spec|\.test|Test)\.ts/,
reports: {
"clover": "coverage",
// "cobertura": "coverage",
"html": "coverage",
"json-summary": "coverage",
"json": "coverage",
// "lcovonly": "coverage",
//"teamcity": "coverage", // "destination/path" or null or ""
// "text-lcov": "coverage", // ...
"text": null
}
},

reporters: ["progress", "karma-typescript"],

browsers: ['Chrome']
});
};

 

Using phpStorm 2016.3.2 with current Karma runner plugin. 

I'm a bit clueless right now... might just be monday though. Ideas? :)

 

 

0
4 comments

seems you are selecting the locally installed Karma package (C:\git\ts-http-client\node_modules\karma) when running via IntelliJ, right? But, when executing 'karma start' in command line, you are likely using global installation. Try choosing a global package in Idea - does it work? When working with karma, you need to make sure that all required packages are available to the chosen Karma version - i.e., when using local package, you need to make sure to install all dependencies locally and vice versa

0

I recreated the issue, logged as https://youtrack.jetbrains.com/issue/WEB-24776; please feel free to vote for it

0
Avatar
Permanently deleted user

Thanks for the quick reply.

I've been using the local package in phpStorm and via karma start.

Using the globally installed karma-cli to run karma start should result in using the locally installed karma package and plugins if available. Using the global karma explicitly (via the configurations) will result in the karma-typescript package not being found (which is completely correct^^).

I will vote on the issue and for now will read coverage the old-timy-way :)

0
Avatar
Permanently deleted user

Hey guys, this issue has been fixed in karma-typescript 2.1.6!

2

Please sign in to leave a comment.