Skip to content

Commit

Permalink
Gruntfile: Add "phantom" task; avoid displaying Saucelabs or adding t…
Browse files Browse the repository at this point in the history
…estJobs when not needed (e.g., for "dev"); document
  • Loading branch information
brettz9 committed Mar 26, 2016
1 parent 429a282 commit ed4071a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
21 changes: 12 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,23 @@ module.exports = function (grunt) {
});

var devJobs = ['eslint', 'babel', 'browserify', 'uglify', 'clean', 'jade'];
var testJobs = devJobs.concat('connect');
if (saucekey && !process.env.TRAVIS_PULL_REQUEST) {
console.info('adding Saucelabs integration');
testJobs.push('saucelabs-mocha');
}

var karmaJobs = devJobs.slice();
if (process.env.TRAVIS_JOB_ID) {
testJobs.push('karma:ci');
karmaJobs.push('karma:ci');
} else {
testJobs.push('karma:dev-single');
karmaJobs.push('karma:dev-single');
}

grunt.registerTask('dev', devJobs);
grunt.registerTask('test', testJobs);
grunt.registerTask('phantom', karmaJobs);
grunt.registerTask('test', function () {
var testJobs = karmaJobs.concat('connect');
if (saucekey && !process.env.TRAVIS_PULL_REQUEST) {
console.info('adding Saucelabs integration');
testJobs.push('saucelabs-mocha');
}
grunt.task.run(testJobs);
});
grunt.registerTask('default', 'test');
grunt.registerTask('test:local', function () {
grunt.task.run(devJobs);
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,24 @@ library.
# Contributor notes

- `npm install` to install all the dependencies

In browser:

- `npm run grunt test:local` to run the mocha server
- Open (`http://localhost:9999/tests`)[] to run the mocha tests

In Node.js:

- `npm test`

or to avoid Saucelabs if set up:

- `npm run grunt phantom`

or to also avoid PhantomJS:

- `npm run grunt dev`

# License

The MIT License
Expand Down

0 comments on commit ed4071a

Please sign in to comment.