Switch to grunt-mocha-cli

The grunt-mocha-test task seems to be causing problems with our
beforeEach handlers in some cases. The grunt-mocha-cli task runs the
mocha command using grunt.util.spawn for more consistent results
This commit is contained in:
Jacob Gable 2013-07-09 17:54:57 -05:00
parent 2b7ba8044b
commit 8545f5806e
3 changed files with 8 additions and 14 deletions

View File

@ -66,7 +66,7 @@ var path = require('path'),
} }
}, },
mochaTest: { mochacli: {
options: { options: {
ui: "bdd", ui: "bdd",
reporter: "spec" reporter: "spec"
@ -229,7 +229,7 @@ var path = require('path'),
grunt.initConfig(cfg); grunt.initConfig(cfg);
grunt.loadNpmTasks("grunt-jslint"); grunt.loadNpmTasks("grunt-jslint");
grunt.loadNpmTasks("grunt-mocha-test"); grunt.loadNpmTasks("grunt-mocha-cli");
grunt.loadNpmTasks("grunt-shell"); grunt.loadNpmTasks("grunt-shell");
grunt.loadNpmTasks("grunt-bump"); grunt.loadNpmTasks("grunt-bump");
@ -253,13 +253,13 @@ var path = require('path'),
grunt.registerTask("init", ["shell:bourbon", "sass:admin", 'handlebars']); grunt.registerTask("init", ["shell:bourbon", "sass:admin", 'handlebars']);
// Run API tests only // Run API tests only
grunt.registerTask("test-api", ["mochaTest:api"]); grunt.registerTask("test-api", ["mochacli:api"]);
// Run permisisons tests only // Run permisisons tests only
grunt.registerTask("test-p", ["mochaTest:perm"]); grunt.registerTask("test-p", ["mochacli:perm"]);
// Run tests and lint code // Run tests and lint code
grunt.registerTask("validate", ["jslint", "mochaTest:all"]); grunt.registerTask("validate", ["jslint", "mochacli:all"]);
// Generate Docs // Generate Docs
grunt.registerTask("docs", ["groc"]); grunt.registerTask("docs", ["groc"]);

View File

@ -13,20 +13,14 @@ var _ = require("underscore"),
describe('permissions', function () { describe('permissions', function () {
should.exist(permissions);
beforeEach(function (done) { beforeEach(function (done) {
helpers.resetData().then(function (result) { helpers.resetData().then(function (result) {
return when(helpers.insertDefaultUser()); return helpers.insertDefaultUser();
}).then(function (results) { }).then(function (results) {
done(); done();
}).otherwise(errors.logAndThrowError); }).otherwise(errors.logAndThrowError);
}); });
// beforeEach(function (done) {
// helpers.resetData().then(function () { done(); }, errors.throwError);
// });
var testPerms = [ var testPerms = [
{ act: "edit", obj: "post" }, { act: "edit", obj: "post" },
{ act: "edit", obj: "tag" }, { act: "edit", obj: "tag" },

View File

@ -26,7 +26,6 @@
"grunt": "~0.4.1", "grunt": "~0.4.1",
"grunt-jslint": "git+https://github.com/ErisDS/grunt-jslint.git#custom", "grunt-jslint": "git+https://github.com/ErisDS/grunt-jslint.git#custom",
"should": "~1.2.2", "should": "~1.2.2",
"grunt-mocha-test": "~0.4.0",
"grunt-shell": "~0.2.2", "grunt-shell": "~0.2.2",
"grunt-contrib-sass": "~0.3.0", "grunt-contrib-sass": "~0.3.0",
"sinon": "~1.7.2", "sinon": "~1.7.2",
@ -37,6 +36,7 @@
"grunt-contrib-copy": "~0.4.1", "grunt-contrib-copy": "~0.4.1",
"grunt-contrib-compress": "~0.5.2", "grunt-contrib-compress": "~0.5.2",
"mocha-as-promised": "~1.4.0", "mocha-as-promised": "~1.4.0",
"grunt-groc": "~0.3.0" "grunt-groc": "~0.3.0",
"grunt-mocha-cli": "~1.0.6"
} }
} }