-
-
Notifications
You must be signed in to change notification settings - Fork 255
Conversation
Although this fixes the issue there are some remaining issues:
For 1-2 I suggest explicitly telling what to cover:
And then use that to concat to (this is a breaking change of course :/ ) These should probably be split out into new issues. |
@egoist I'll examine this further. It shouldn't be necessary to specify the source files, so something else must be wrong. Please ignore this PR for now :) |
Maaaan, this took some time to get right. There are so many test/coverage/transpiler modules out there that are influx. This is not the time for coverage of es6 with tests written in es6 hehe. But it works now: A key part of getting it to work was to use an old version of |
does this work on .vue files? |
Not sure, will test. |
It does work, however it will includes other files as well -- used to transpile vue. |
I think I might need to do something like this vuejs/vue-loader#7 (comment) to get it working correctly with vue. |
Also this may be relevant: webpack-contrib/istanbul-instrumenter-loader#73 |
Btw, for context |
0b71a8c
to
2ef1ea6
Compare
@egoist I got code coverage working on both regular js and on vue. Also I sorted out the excess files included in the reports to that the coverage values are now accurate. There is one part of the solution I'm not particular happy with and I was wondering if there are other ways to modify and existing loader than the way I am doing. (the mapping of rules part) js: vue: |
It is important to note that this is version 0.2.0 of the module. Versions after that does not support the html and lcov reporters (lcovonly is supported).
packages/poi-preset-karma/index.js
Outdated
} | ||
].concat(webpackConfig.module.rules) | ||
/* for vue (assumes vue-loader) */ | ||
webpackConfig.module.rules = webpackConfig.module.rules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually you can update webpack config in poi.extendWebpack('test', config => {})
using webpack-chain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will update this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I'm new to webpack-chain
will check it out. It looks promising.
packages/poi-preset-karma/index.js
Outdated
const options = r.use[vueLoaderPos].options | ||
const instrumenterLoader = 'istanbul-instrumenter-loader?esModules=true' | ||
options.preLoaders = (options.preLoaders || {}) | ||
options.preLoaders.js = typeof options.preLoaders.js === 'string' ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it's preLoader for .vue file but postLoader for .js file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it should be pre for both. If you use post it will run the coverage after the babel-plugin-add-module-exports
has run which adds something like this to the top:
Do you want me to change both to pre (as they should be) or can you correct it when you add the webpack-chain stuff @egoist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks I will webpack-chain-ify it later today
Fix for #245
The coverage preprocessor was never added when enabling
coverage
. It was only added as reporter.UPDATE: After submitting the first PR the code has gone in a different direction after reading hundreds of githubs issues, PRs, boilerplates, etc.
coverage
should not be a preprocessor and also you don't have to add your src files tofiles
it is enough to include the test files.