Make it possible to run node tests from npm/grunt

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-05-16 13:28:48 -04:00 committed by Kieran Sedgwick
parent e041c2d904
commit 2d6b4644df
2 changed files with 6 additions and 17 deletions

View File

@ -51,22 +51,9 @@ module.exports = function(grunt) {
] ]
}, },
connect: { shell: {
server: {
options: {
port: 9001,
hostname: '127.0.0.1',
base: '.'
}
}
},
mocha: { mocha: {
test: { command: './node_modules/.bin/mocha --reporter list --no-exit tests/node-runner.js'
options: {
log: true,
urls: [ 'http://127.0.0.1:9001/tests/index.html' ]
}
} }
}, },
@ -179,11 +166,11 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-npm'); grunt.loadNpmTasks('grunt-npm');
grunt.loadNpmTasks('grunt-git'); grunt.loadNpmTasks('grunt-git');
grunt.loadNpmTasks('grunt-prompt'); grunt.loadNpmTasks('grunt-prompt');
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('develop', ['clean', 'requirejs']); grunt.registerTask('develop', ['clean', 'requirejs']);
grunt.registerTask('release', ['develop', 'uglify']); grunt.registerTask('release', ['develop', 'uglify']);
grunt.registerTask('check', ['jshint']); 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) { grunt.registerTask('publish', 'Publish filer as a new version to NPM, bower and github.', function(patchLevel) {
var allLevels = ['patch', 'minor', 'major']; var allLevels = ['patch', 'minor', 'major'];
@ -214,6 +201,7 @@ module.exports = function(grunt) {
'npm-publish' 'npm-publish'
]); ]);
}); });
grunt.registerTask('test', ['check', 'shell:mocha']);
grunt.registerTask('default', ['develop']); grunt.registerTask('default', ['develop']);
}; };

View File

@ -39,6 +39,7 @@
"grunt-contrib-uglify": "~0.1.2", "grunt-contrib-uglify": "~0.1.2",
"grunt-contrib-watch": "~0.3.1", "grunt-contrib-watch": "~0.3.1",
"grunt-git": "0.2.10", "grunt-git": "0.2.10",
"grunt-shell": "~0.7.0",
"grunt-mocha": "0.4.10", "grunt-mocha": "0.4.10",
"grunt-npm": "git://github.com/sedge/grunt-npm.git#branchcheck", "grunt-npm": "git://github.com/sedge/grunt-npm.git#branchcheck",
"grunt-prompt": "^1.1.0", "grunt-prompt": "^1.1.0",