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

fix(infrastructure): unit test code coverage for typescript #487

Merged
merged 98 commits into from
Dec 19, 2018

Conversation

moog16
Copy link

@moog16 moog16 commented Dec 4, 2018

related #48

This took me a long time to find. But basically my issue was karma-coverage does not work with istanbul-instrumenter-loader. Solution/Issue is documented on webpack-contrib/istanbul-instrumenter-loader#32. This github issue led me to using karma-coverage-istanbul-reporter instead, which is a fork of karma-coverage.

Copy link
Contributor

@bonniezhou bonniezhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some comment just to clarify my understanding, but LGTM!

@@ -24,11 +24,11 @@ module.exports = {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/unit/index.tsx': ['webpack'],
'test/unit/index.tsx': ['webpack', 'sourcemap'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does sourcemap do?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you get minified or transpiled code (like things generated by ts-loader and babel-loader), its difficult to read when debugging. Sourcemaps provide a way for the browser to show the developer the original code (or at least readable). :)

enforce: 'post',
test: /\.(js|ts)x?$/,
use: {
loader: 'istanbul-instrumenter-loader',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that we're using istanbul-instrumenter-loader now instead of the istanbul webpack plugin, is that correct? can we remove istanbul from the package.json or does the loader require it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

istanbul-instrumenter-loader requires istanbul...like when create-react-app requires node-sass when you want to use sass.

We needed to switch it because we the istanbul webpack plugin does not work with typescript.

@moog16 moog16 changed the base branch from feat/typings to feat/two-typescript December 19, 2018 22:45
@moog16 moog16 changed the base branch from feat/two-typescript to feat/typings December 19, 2018 22:45
@moog16 moog16 changed the base branch from feat/typings to feat/two-typescript December 19, 2018 23:22
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@moog16 moog16 merged commit 39ef66a into feat/two-typescript Dec 19, 2018
@moog16 moog16 deleted the fix/coverage-typescript branch January 23, 2019 21:09
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

Successfully merging this pull request may close these issues.

6 participants