Skip to content

Commit

Permalink
chore: use grunt to install optional phantomjs
Browse files Browse the repository at this point in the history
connected to #3993
  • Loading branch information
virkt25 committed Sep 11, 2018
1 parent c9164ae commit a2f602b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 9 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ module.exports = function(grunt) {
},
},
},
run: {
optionalInstall: {
exec: 'npm install --no-save --silent karma-phantomjs-launcher phantomjs-prebuilt',
},
},
eslint: {
gruntfile: {
src: 'Gruntfile.js',
Expand Down Expand Up @@ -211,6 +216,7 @@ module.exports = function(grunt) {
});

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-run');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-eslint');
Expand All @@ -236,12 +242,14 @@ module.exports = function(grunt) {
// Default task.
grunt.registerTask('default', ['browserify']);

grunt.registerTask('phantomTests', ['run', 'karma:unit-once']);

grunt.registerTask('test', [
'eslint',
process.env.JENKINS_HOME ? 'mochaTest:unit-xml' : 'mochaTest:unit',
process.env.JENKINS_HOME && (/^win/.test(process.platform) ||
/^s390x/.test(process.arch) || /^ppc64/.test(process.arch)) ?
'skip-karma' : 'karma:unit-once',
'skip-karma' : 'phantomTests',
]);

// alias for sl-ci-run and `npm test`
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"grunt-eslint": "^21.0.0",
"grunt-karma": "^2.0.0",
"grunt-mocha-test": "^0.13.3",
"grunt-run": "^0.8.1",
"karma": "^1.1.2",
"karma-browserify": "^5.1.1",
"karma-chrome-launcher": "^1.0.1",
Expand All @@ -90,13 +91,11 @@
"karma-html2js-preprocessor": "^1.0.0",
"karma-junit-reporter": "~1.0.0",
"karma-mocha": "^1.1.1",
"karma-phantomjs-launcher": "^1.0.0",
"karma-script-launcher": "^1.0.0",
"loopback-boot": "^2.7.0",
"loopback-context": "^1.0.0",
"mocha": "^5.2.0",
"nyc": "^10.1.2",
"phantomjs-prebuilt": "^2.1.7",
"sinon": "^6.1.4",
"sinon-chai": "^3.2.0",
"strong-error-handler": "^3.0.0",
Expand Down

0 comments on commit a2f602b

Please sign in to comment.