-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
45 lines (40 loc) · 1.16 KB
/
gulpfile.js
File metadata and controls
45 lines (40 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'use strict';
var gulp = require('gulp');
var path = require('path');
var service, proxyPort;
/**
* Run test scripts
*/
gulp.task('test', function(done) {
var packageJson = require('./package.json');
if (packageJson.dependencies['@syncfusion/ej2-data'] || packageJson.name === '@syncfusion/ej2-data') {
console.log('Service Started');
var spawn = require('child_process').spawn;
service = spawn('node', [path.join(__dirname, '/spec/services/V4service.js')]);
service.stdout.on('data', (data) => {
proxyPort = data.toString().trim();
console.log('Proxy port: ' + proxyPort);
startKarma(done);
});
} else {
startKarma(done);
}
});
function startKarma(done) {
var karma = require('karma');
return new karma.Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
}, function(e) {
if (service) {
service.kill();
}
if (e === 1) {
console.log('Karma has exited with ' + e);
process.exit(e);
} else {
done();
}
}).start();
}