From 2d6b4644dfc2561929cdfc57cdc61d7ee01a8a5d Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Fri, 16 May 2014 13:28:48 -0400 Subject: [PATCH] Make it possible to run node tests from npm/grunt --- gruntfile.js | 22 +++++----------------- package.json | 1 + 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/gruntfile.js b/gruntfile.js index beb6b3f..1440ec6 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -51,22 +51,9 @@ module.exports = function(grunt) { ] }, - connect: { - server: { - options: { - port: 9001, - hostname: '127.0.0.1', - base: '.' - } - } - }, - - mocha: { - test: { - options: { - log: true, - urls: [ 'http://127.0.0.1:9001/tests/index.html' ] - } + shell: { + mocha: { + command: './node_modules/.bin/mocha --reporter list --no-exit tests/node-runner.js' } }, @@ -179,11 +166,11 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-npm'); grunt.loadNpmTasks('grunt-git'); grunt.loadNpmTasks('grunt-prompt'); + grunt.loadNpmTasks('grunt-shell'); grunt.registerTask('develop', ['clean', 'requirejs']); grunt.registerTask('release', ['develop', 'uglify']); grunt.registerTask('check', ['jshint']); - grunt.registerTask('test', ['check', 'connect', 'mocha']); grunt.registerTask('publish', 'Publish filer as a new version to NPM, bower and github.', function(patchLevel) { var allLevels = ['patch', 'minor', 'major']; @@ -214,6 +201,7 @@ module.exports = function(grunt) { 'npm-publish' ]); }); + grunt.registerTask('test', ['check', 'shell:mocha']); grunt.registerTask('default', ['develop']); }; diff --git a/package.json b/package.json index 49af3a1..2eea605 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "grunt-contrib-uglify": "~0.1.2", "grunt-contrib-watch": "~0.3.1", "grunt-git": "0.2.10", + "grunt-shell": "~0.7.0", "grunt-mocha": "0.4.10", "grunt-npm": "git://github.com/sedge/grunt-npm.git#branchcheck", "grunt-prompt": "^1.1.0",