From b686a7f4a18661e1618aa4b580ff97030a060aa5 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 5 Feb 2015 13:58:07 -0800 Subject: [PATCH] Fixed running tests with karma. --- app/assets/javascripts/run-tests.js | 4 +++- app/core/initialize.coffee | 2 ++ karma.conf.js | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/run-tests.js b/app/assets/javascripts/run-tests.js index 913f71fe3..a32c38e6e 100644 --- a/app/assets/javascripts/run-tests.js +++ b/app/assets/javascripts/run-tests.js @@ -1,8 +1,10 @@ // Helper for running tests through Karma. // Hooks into the test view logic for running tests. + +window.userObject = {_id:'1'} initialize = require('core/initialize'); initialize.init(); console.debug = function() {}; // Karma conf doesn't seem to work? Debug messages are still emitted when they shouldn't be. TestView = require('views/TestView'); -TestView.runTests(); \ No newline at end of file +TestView.runTests(); diff --git a/app/core/initialize.coffee b/app/core/initialize.coffee index 3d42b664a..0ad7b49da 100644 --- a/app/core/initialize.coffee +++ b/app/core/initialize.coffee @@ -43,6 +43,8 @@ init = -> handleNormalUrls() setUpMoment() # Set up i18n for moment +module.exports.init = init + handleNormalUrls = -> # http://artsy.github.com/blog/2012/06/25/replacing-hashbang-routes-with-pushstate/ $(document).on 'click', "a[href^='/']", (event) -> diff --git a/karma.conf.js b/karma.conf.js index 00ba3af7f..c7ed0175d 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -9,6 +9,7 @@ module.exports = function(config) { // list of files / patterns to load in the browser files : [ + 'public/javascripts/vendor.js', // need for jade definition... 'public/javascripts/whole-vendor.js', 'public/lib/ace/ace.js', 'public/javascripts/aether.js',