Skip to content

Commit 5e54f3e

Browse files
committed
chore: use grunt to optionally install the dependency
connected to #3993
1 parent c9164ae commit 5e54f3e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Gruntfile.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ module.exports = function(grunt) {
3131
},
3232
},
3333
},
34+
run: {
35+
optionalInstall: {
36+
exec: 'npm install --no-save --silent karma-phantomjs-launcher phantomjs-prebuilt',
37+
},
38+
},
3439
eslint: {
3540
gruntfile: {
3641
src: 'Gruntfile.js',
@@ -211,6 +216,7 @@ module.exports = function(grunt) {
211216
});
212217

213218
// These plugins provide necessary tasks.
219+
grunt.loadNpmTasks('grunt-run');
214220
grunt.loadNpmTasks('grunt-browserify');
215221
grunt.loadNpmTasks('grunt-contrib-uglify');
216222
grunt.loadNpmTasks('grunt-eslint');
@@ -236,12 +242,14 @@ module.exports = function(grunt) {
236242
// Default task.
237243
grunt.registerTask('default', ['browserify']);
238244

245+
grunt.registerTask('phantomTests', ['run', 'karma:unit-once']);
246+
239247
grunt.registerTask('test', [
240248
'eslint',
241249
process.env.JENKINS_HOME ? 'mochaTest:unit-xml' : 'mochaTest:unit',
242250
process.env.JENKINS_HOME && (/^win/.test(process.platform) ||
243251
/^s390x/.test(process.arch) || /^ppc64/.test(process.arch)) ?
244-
'skip-karma' : 'karma:unit-once',
252+
'skip-karma' : 'phantomTests',
245253
]);
246254

247255
// alias for sl-ci-run and `npm test`

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"grunt-eslint": "^21.0.0",
8383
"grunt-karma": "^2.0.0",
8484
"grunt-mocha-test": "^0.13.3",
85+
"grunt-run": "^0.8.1",
8586
"karma": "^1.1.2",
8687
"karma-browserify": "^5.1.1",
8788
"karma-chrome-launcher": "^1.0.1",
@@ -90,13 +91,11 @@
9091
"karma-html2js-preprocessor": "^1.0.0",
9192
"karma-junit-reporter": "~1.0.0",
9293
"karma-mocha": "^1.1.1",
93-
"karma-phantomjs-launcher": "^1.0.0",
9494
"karma-script-launcher": "^1.0.0",
9595
"loopback-boot": "^2.7.0",
9696
"loopback-context": "^1.0.0",
9797
"mocha": "^5.2.0",
9898
"nyc": "^10.1.2",
99-
"phantomjs-prebuilt": "^2.1.7",
10099
"sinon": "^6.1.4",
101100
"sinon-chai": "^3.2.0",
102101
"strong-error-handler": "^3.0.0",

0 commit comments

Comments
 (0)