From 8545f5806eb4d1a0bf45f997c9f79602ba13adad Mon Sep 17 00:00:00 2001 From: Jacob Gable Date: Tue, 9 Jul 2013 17:54:57 -0500 Subject: [PATCH] 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 --- Gruntfile.js | 10 +++++----- core/test/ghost/permissions_spec.js | 8 +------- package.json | 4 ++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 59830e60c7..b45431260c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -66,7 +66,7 @@ var path = require('path'), } }, - mochaTest: { + mochacli: { options: { ui: "bdd", reporter: "spec" @@ -229,7 +229,7 @@ var path = require('path'), grunt.initConfig(cfg); grunt.loadNpmTasks("grunt-jslint"); - grunt.loadNpmTasks("grunt-mocha-test"); + grunt.loadNpmTasks("grunt-mocha-cli"); grunt.loadNpmTasks("grunt-shell"); grunt.loadNpmTasks("grunt-bump"); @@ -253,13 +253,13 @@ var path = require('path'), grunt.registerTask("init", ["shell:bourbon", "sass:admin", 'handlebars']); // Run API tests only - grunt.registerTask("test-api", ["mochaTest:api"]); + grunt.registerTask("test-api", ["mochacli:api"]); // Run permisisons tests only - grunt.registerTask("test-p", ["mochaTest:perm"]); + grunt.registerTask("test-p", ["mochacli:perm"]); // Run tests and lint code - grunt.registerTask("validate", ["jslint", "mochaTest:all"]); + grunt.registerTask("validate", ["jslint", "mochacli:all"]); // Generate Docs grunt.registerTask("docs", ["groc"]); diff --git a/core/test/ghost/permissions_spec.js b/core/test/ghost/permissions_spec.js index b330dc8cd9..9f687d9d9b 100644 --- a/core/test/ghost/permissions_spec.js +++ b/core/test/ghost/permissions_spec.js @@ -13,20 +13,14 @@ var _ = require("underscore"), describe('permissions', function () { - should.exist(permissions); - beforeEach(function (done) { helpers.resetData().then(function (result) { - return when(helpers.insertDefaultUser()); + return helpers.insertDefaultUser(); }).then(function (results) { done(); }).otherwise(errors.logAndThrowError); }); - // beforeEach(function (done) { - // helpers.resetData().then(function () { done(); }, errors.throwError); - // }); - var testPerms = [ { act: "edit", obj: "post" }, { act: "edit", obj: "tag" }, diff --git a/package.json b/package.json index 589c745f91..8197230780 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "grunt": "~0.4.1", "grunt-jslint": "git+https://github.com/ErisDS/grunt-jslint.git#custom", "should": "~1.2.2", - "grunt-mocha-test": "~0.4.0", "grunt-shell": "~0.2.2", "grunt-contrib-sass": "~0.3.0", "sinon": "~1.7.2", @@ -37,6 +36,7 @@ "grunt-contrib-copy": "~0.4.1", "grunt-contrib-compress": "~0.5.2", "mocha-as-promised": "~1.4.0", - "grunt-groc": "~0.3.0" + "grunt-groc": "~0.3.0", + "grunt-mocha-cli": "~1.0.6" } }