From 63d8cbb87ce685a2ab29dd0f0b84bb7c5a3fe0fe Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Fri, 13 Sep 2013 08:24:28 +0100 Subject: [PATCH] Unit tests require config file to be present. Conflicts: Gruntfile.js core/test/unit/admin_spec.js --- Gruntfile.js | 16 ++++++++++++---- core/test/unit/admin_spec.js | 1 - 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 3532fa7b54..d9166af1d4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,10 +3,12 @@ var path = require('path'), semver = require("semver"), fs = require("fs"), path = require("path"), + _ = require('underscore'), spawn = require("child_process").spawn, buildDirectory = path.resolve(process.cwd(), '.build'), distDirectory = path.resolve(process.cwd(), '.dist'), - _ = require('underscore'), + configLoader = require('./core/config-loader.js'), + configureGrunt = function (grunt) { // load all grunt tasks @@ -351,6 +353,13 @@ var path = require('path'), process.env.NODE_ENV = process.env.TRAVIS ? 'travis' : 'testing'; }); + grunt.registerTask('loadConfig', function () { + var done = this.async(); + configLoader.loadConfig().then(function () { + done(); + }); + }); + // Update the package information after changes grunt.registerTask('updateCurrentPackageInfo', function () { cfg.pkg = grunt.file.readJSON('package.json'); @@ -681,13 +690,12 @@ var path = require('path'), "watch" ]); - // Prepare the project for development // TODO: Git submodule init/update (https://github.com/jaubourg/grunt-update-submodules)? grunt.registerTask("init", ["shell:bourbon", "sass:admin", 'handlebars']); - // Run unit tests - grunt.registerTask("test-unit", ['setTestEnv', "mochacli:all"]); + // Run unit tests + grunt.registerTask("test-unit", ['setTestEnv', 'loadConfig', "mochacli:all"]); // Run casperjs tests only grunt.registerTask('test-functional', ['setTestEnv', 'express:test', 'spawn-casperjs']); diff --git a/core/test/unit/admin_spec.js b/core/test/unit/admin_spec.js index 5a82fd832c..adbbd3f8d5 100644 --- a/core/test/unit/admin_spec.js +++ b/core/test/unit/admin_spec.js @@ -38,7 +38,6 @@ describe('Admin Controller', function() { }); }); - describe('valid file', function() { var clock;