-
Notifications
You must be signed in to change notification settings - Fork 10
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
Problems running with typescript #13
Comments
Can't get this to work with Typescript as well. When not using Istanbul plugin, the sourcemaps are loaded correctly for all files in the bundle. With istanbul, the instrumented files "loose" their mapping. Not sure this should happen already in the first place, but then the coverage report gets the wrong lines as mentioned in marcoturi/ionic-boilerplate#5 The plugin is instrumenting the transpiled and bundled code. The instrumented parts point to the original file (TS), but somehow seem to actually map the intermediary transpiled ( intermediary export function foo() {
return 1;
}
export function bar(smt) {
return smt === 'foo';
}
{
"compilerOptions": {
"target": "es6",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true
}
}
const node = require('rollup-plugin-node-resolve')
const tsc = require('rollup-plugin-typescript')
const typescript = require('typescript')
const istanbul = require('rollup-plugin-istanbul')
const TESTS = 'test.ts'
const EXTERNAL = 'node_modules/**/*'
module.exports = function (config) {
config.set({
frameworks: ['jasmine'],
files: [ TESTS ],
preprocessors: {
[TESTS]: ['rollup']
},
rollupPreprocessor: {
plugins: [
tsc({typescript}),
node({ jsnext: true }),
istanbul({
exclude: [TESTS, EXTERNAL]
})
],
format: 'iife',
sourceMap: 'inline'
},
reporters: ['coverage'],
browsers: ['Chrome'],
singleRun: true
})
} I've tried to compile TS before running Karma, having sourcemaps available for remap-istanbul but to no success or little success. |
@joaovieira I had a similar issue, where line numbers were not accurate; I solved that by using: instrumenterConfig: {
embedSource: true
} Not sure if that's any help. @marcoturi I too experienced karma-runner/karma-coverage#157 And in the Istanbul repo: There's even a fork of the latest istanbul with an alleged fix: |
Sorry for being late answering here. The new v2.0.0 version uses now the new istanbul instrumenter. Please double check if you keep suffering the error. |
Hi @artberri and thank you for your plugin. I'm having a similar issue of #6 , but with typescript. Here is the code i use:
https://github.com/hotforfeature/ionic2-boilerplate/blob/master/config/karma.conf.js
I can't put rollup-plugin-istanbul before rollup-plugin-typescript otherwise I get:
At the same time i get the istanbul/lib/report/html.js:241:45 error of #6 if i keep the plugin after the others. For further info marcoturi/ionic-boilerplate#5
The text was updated successfully, but these errors were encountered: