Skip to content

Commit 015419b

Browse files
author
Shahak Yosef
committed
Merged PR 145115: Improve kjhtml
Fixes two problems: - Auto watch doesn't re-run tests on file changes - Closing tests window doesn't close the test process in the command line
1 parent 408ada9 commit 015419b

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

gulpfile.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var ghPages = require('gulp-gh-pages'),
1212
moment = require('moment'),
1313
karma = require('karma'),
1414
typedoc = require('gulp-typedoc'),
15+
watch = require('gulp-watch'),
1516
webpack = require('webpack'),
1617
webpackStream = require('webpack-stream'),
1718
webpackConfig = require('./webpack.config'),
@@ -213,5 +214,21 @@ gulp.task('test:js', 'Run js tests', function (done) {
213214
captureTimeout: argv.timeout || 60000
214215
}, function() {
215216
done();
216-
}).start();
217+
})
218+
.on('browser_register', (browser) => {
219+
if (argv.chrome) {
220+
browser.socket.on('disconnect', function (reason) {
221+
if (reason === "transport close" || reason === "transport error") {
222+
done(0);
223+
process.exit(0);
224+
}
225+
});
226+
}
227+
})
228+
.start();
229+
if (argv.chrome) {
230+
return watch(["src/**/*.ts", "test/**/*.ts"], function () {
231+
runSequence('compile:spec');
232+
});
233+
}
217234
});

karma.conf.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ else if (argv.firefox) {
88
browserName = 'Firefox'
99
}
1010
const flags = [
11-
'--disable-gpu',
1211
'--disable-extensions',
1312
'--no-proxy-server',
1413
'--js-flags="--max_old_space_size=6500"',
@@ -34,7 +33,7 @@ module.exports = function (config) {
3433
'karma-spec-reporter',
3534
'karma-phantomjs-launcher',
3635
'karma-coverage',
37-
'karma-jasmine-html-reporter',
36+
'karma-jasmine-html-reporter'
3837
],
3938
customLaunchers: {
4039
'Chrome_headless': {
@@ -49,8 +48,8 @@ module.exports = function (config) {
4948
{ type: 'text-summary' }
5049
]
5150
},
52-
logLevel: argv.debug ? config.LOG_DEBUG : config.LOG_INFO,
5351
retryLimit: 0,
52+
logLevel: argv.debug ? config.LOG_DEBUG : config.LOG_INFO,
5453
client: {
5554
clearContext: false, // leave Jasmine Spec Runner output visible in browser
5655
args: argv.logMessages ? ['logMessages'] : []

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"prestart": "cd demo && npm install",
1717
"test": "gulp test",
1818
"gulp": "gulp",
19-
"testc": "npm test -- --chrome --watch"
19+
"tests": "npm test -- --chrome --watch --debug"
2020
},
2121
"keywords": [
2222
"microsoft",
@@ -55,6 +55,7 @@
5555
"gulp-replace": "^0.5.4",
5656
"gulp-typedoc": "^2.0.0",
5757
"gulp-typescript": "^4.0.1",
58+
"gulp-watch": "^5.0.1",
5859
"gulp4-run-sequence": "^1.0.0",
5960
"http-server": "^0.12.1",
6061
"ignore-loader": "^0.1.1",

0 commit comments

Comments
 (0)