From 5167046c7426e56544d8c7b474e3bc2fb868cc2b Mon Sep 17 00:00:00 2001 From: Kieran Sedgwick Date: Fri, 30 May 2014 13:27:11 -0400 Subject: [PATCH] Closes #211 - Update grunt test command --- CONTRIBUTING.md | 4 ++-- gruntfile.js | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ae679ae..22576fb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,8 +21,8 @@ You can now run the following grunt tasks: * `grunt check` will run [JSHint](http://www.jshint.com/) on your code (do this before submitting a pull request) to catch errors * `grunt develop` will create a single file version of the library for testing in `dist/idbfs.js` * `grunt release` like `develop` but will also create a minified version of the library in `dist/idbfs.min.js` -* `grunt test` or `grunt test-node` will run [JSHint](http://www.jshint.com/) on your code and the test suite in the context of `nodejs` -* `grunt test-browser` will run [JSHint](http://www.jshint.com/) and start a localhost server on port `1234`. Navigating to `localhost:1234/tests/index.html` will run the test suite in the context of the browser. **NOTE:** When finished, you will have to manually shut off the server by pressing `cmd/ctrl`+`c` in the same terminal session you ran `grunt test-browser`. +* `grunt test` or `grunt test:node` will run [JSHint](http://www.jshint.com/) on your code and the test suite in the context of `nodejs` +* `grunt test:browser` will run [JSHint](http://www.jshint.com/) and start a localhost server on port `1234`. Navigating to `localhost:1234/tests/index.html` will run the test suite in the context of the browser. **NOTE:** When finished, you will have to manually shut off the server by pressing `cmd/ctrl`+`c` in the same terminal session you ran `grunt test:browser`. Once you've done some hacking and you'd like to have your work merged, you'll need to make a pull request. If you're patch includes code, make sure to check that all the diff --git a/gruntfile.js b/gruntfile.js index 8113ed4..2e62d55 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -211,7 +211,11 @@ module.exports = function(grunt) { }); grunt.registerTask('test-node', ['jshint', 'connect:serverForNode', 'shell:mocha']); grunt.registerTask('test-browser', ['jshint', 'build-tests', 'connect:serverForBrowser']); - grunt.registerTask('test', ['test-node']); + grunt.registerTask('test', function(context) { + context = (context || 'node').toLowerCase(); + + grunt.task.run([context == 'node' ? 'test-node' : 'test-browser']); + }); grunt.registerTask('default', ['test']); };