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: emit error and prevent re-test #235

Closed
wants to merge 1 commit into from
Closed

Conversation

joshwiens
Copy link
Contributor

@joshwiens joshwiens commented Mar 28, 2017

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)

Currently karma-webpack is swallowing fatal compilation errors which has a substantial negative effect on the development experience.

What is the new behavior?

  • karma-webpack: compiler.plugin will throw on any fatal compilation error.
  • karma-webpack: compiler.plugin will prevent re-running tests on the above condition.
  • karma-webpack: addEntry will not propagate errors for failed module imports.

Does this PR introduce a breaking change?

  • Yes
  • No

If this PR contains a breaking change, please describe the following...

  • Impact:
  • Migration path for existing applications:
  • Github Issue(s) this is regarding:

This needs to be tested with @angular/cli before it's merged.

Relates to: #49
Relates to: #66

Copy link

@bebraw bebraw left a comment

Choose a reason for hiding this comment

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

As long as stats.compilation is defined, this is ok. Better with tests but you might have a plan for that. 👍

@joshwiens
Copy link
Contributor Author

joshwiens commented Mar 28, 2017

Long story in regards to the tests. Now that karma-webpack is maintained by @webpack-contrib/org-maintainers this is going to all get sorted out in short order with the defaults upgrade.

@joshwiens joshwiens force-pushed the d3viant0ne-EmitErrors branch from 4330c3a to ece82eb Compare March 28, 2017 16:43
@joshwiens
Copy link
Contributor Author

@filipesilva - This should cover both of the plugins currently needed by @angular/cli. I'll get it merged & published after a few tests in one of my cli based apps.

@filipesilva
Copy link

Awesome, thanks so much for taking on this issue! I'll integrate it into the CLI after it's merged and released.

@filipesilva
Copy link

Let me test this on the CLI as well, as per your original comment.

@filipesilva
Copy link

This is the original commit where I used variations of the plugins in #49 and #66 to fix the error behaviour: angular/angular-cli@8ab3954

The two cases we test for in the CLI are:

  • on watch mode, rebuilds with errors will not rerun tests and instead wait to recompile
  • on single run mode, builds with errors do not hang and exit with an error code

I tried the changes on this PR by applying them over the released version 2.0.3 and removing the custom plugins I had added:

  • on watch mode, rebuilds with errors do not rerun tests and exit the process with an error
  • on single run mode, builds with errors do not hang and exit with an error code

So I would say that the watch mode change is not ideal, since it requires users to re-run Karma on every error. The single-run mode is what we did though.

@joshwiens
Copy link
Contributor Author

joshwiens commented Mar 29, 2017

Give me 30 minutes & i'll fix the watch mode annoyance and properly cover those use cases.

watch mode change is not ideal ... it's down right obnoxious.

@joshwiens
Copy link
Contributor Author

@filipesilva - Got dragged away. After mulling this over for a while and in the spirit of not breaking apps that depend on karma-webpack or everyones CLI apps ( to include my own ) the right answer here imo is to just make this respect the --bail option like it should.

Assuming you don't mind a small PR into the CLI, i'll go the route above.

@filipesilva
Copy link

@d3viant0ne apologies for taking so long to get back to your message. I agree with the approach you've outlined, it's the best option overall.

I was actually worried what direction it might take because of CLI version range, thank you for taking that into consideration 👍

@the-spyke
Copy link

Any news? Just spent almost an hour investigating a strange error in Karma. The root cause was in missing package in node_modules.

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

Successfully merging this pull request may close these issues.

5 participants