Skip to content

Commit 77701cc

Browse files
crisbetojelbourn
authored andcommitted
chore(build): fix karma not exiting properly (#1741)
* Fixes the Karma tasks not exiting properly. This is an issue, because doing a keyboard interrupt doesn't stop the Gulp watchers that are going on in the background. * Increase the time that Karma waits before starting to run tests. This should help mitigate the multiple reloads when running unit tests locally. Related to #1681.
1 parent adfc4d1 commit 77701cc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

test/karma.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export function config(config) {
5959
colors: true,
6060
logLevel: config.LOG_INFO,
6161
autoWatch: true,
62+
autoWatchBatchDelay: 500,
6263

6364
sauceLabs: {
6465
testName: 'material2',

tools/gulp/tasks/unit-test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import gulp = require('gulp');
22
import path = require('path');
33
import gulpMerge = require('merge2');
44

5-
import {PROJECT_ROOT, DIST_COMPONENTS_ROOT} from '../constants';
5+
import {PROJECT_ROOT} from '../constants';
66
import {sequenceTask} from '../task_helpers';
77

88
const karma = require('karma');
@@ -48,20 +48,20 @@ gulp.task(':test:deps:inline', sequenceTask(':test:deps', ':inline-resources'));
4848
*
4949
* This task should be used when running unit tests locally.
5050
*/
51-
gulp.task('test', [':test:watch'], (done: () => void) => {
51+
gulp.task('test', [':test:watch'], () => {
5252
new karma.Server({
5353
configFile: path.join(PROJECT_ROOT, 'test/karma.conf.js')
54-
}, done).start();
54+
}).start();
5555
});
5656

5757
/**
5858
* Runs the unit tests once with inlined resources (html, css). Does not watch for changes.
5959
*
6060
* This task should be used when running tests on the CI server.
6161
*/
62-
gulp.task('test:single-run', [':test:deps:inline'], (done: () => void) => {
62+
gulp.task('test:single-run', [':test:deps:inline'], () => {
6363
new karma.Server({
6464
configFile: path.join(PROJECT_ROOT, 'test/karma.conf.js'),
6565
singleRun: true
66-
}, done).start();
66+
}).start();
6767
});

0 commit comments

Comments
 (0)