Skip to content

fix(@angular-devkit/build-angular): don't rerun tests on unchanged co… #12402

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

Merged
merged 1 commit into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,11 @@ const init: any = (config: any, emitter: any, customFileHandlers: any) => {
blocked = [];
}

let lastCompilationHash: string | undefined;
compiler.hooks.done.tap('karma', (stats: any) => {
// Don't refresh karma when there are webpack errors.
if (stats.compilation.errors.length === 0) {
// Refresh karma only when there are no webpack errors, and if the compilation changed.
if (stats.compilation.errors.length === 0 && stats.hash != lastCompilationHash) {
lastCompilationHash = stats.hash;
emitter.refreshFiles();
}
unblock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { host, karmaTargetSpec } from '../utils';

// Karma watch mode is currently bugged:
// - errors print a huge stack trace
// - karma does not have a way to close the server gracefully.
// - karma does not have a way to close the server
// gracefully (https://github.com/karma-runner/karma/issues/3149)
// TODO: fix these before 6.0 final.
xdescribe('Karma Builder watch mode', () => {
beforeEach(done => host.initialize().toPromise().then(done, done.fail));
Expand Down Expand Up @@ -64,4 +65,9 @@ xdescribe('Karma Builder watch mode', () => {
take(3),
).toPromise().then(done, done.fail);
}, 30000);

it('does not rebuild when nothing changed', (done) => {
// Start the server in watch mode, wait for the first build to finish, touch
// test.js without changing it, wait 5s then exit unsuscribe, verify only one event was emitted.
}, 30000);
Copy link
Member

Choose a reason for hiding this comment

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

There's no code in here. is that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeap, see the comment above. We can't actually test karma in watch mode because there's no way for the karma server to exit gracefully without killing the processes.

Copy link
Contributor

Choose a reason for hiding this comment

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

This at least needs a comment, anyone looking at this code later will be very confused why it claims to test something and then doesn't.
Did you think about another way to test this?

});