Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): don't rerun tests on unchanged co…
Browse files Browse the repository at this point in the history
…mpilation

Fix #11880
  • Loading branch information
filipesilva authored and alexeagle committed Oct 1, 2018
1 parent 14f787a commit 61ce0ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
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
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);
});

0 comments on commit 61ce0ce

Please sign in to comment.