chore: use grunt to install optional phantomjs

connected to #3993
This commit is contained in:
virkt25 2018-09-07 15:31:09 -04:00 committed by Taranveer Virk
parent c9164aed17
commit cab1ed5463
2 changed files with 10 additions and 3 deletions

View File

@ -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',
@ -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');
@ -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`

View File

@ -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",
@ -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",