diff --git a/gruntfile.js b/gruntfile.js index 2e7282e08..6d644cf4d 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -76,6 +76,8 @@ module.exports = function (grunt) { '<%= files.grunt %>', '<%= files.scripts %>', '<%= files.client %>', + 'static/context.js', + 'static/debug.js', 'test/**/*.js', 'gruntfile.js' ] diff --git a/lib/middleware/karma.js b/lib/middleware/karma.js index 9c3168d72..cbedf28e2 100644 --- a/lib/middleware/karma.js +++ b/lib/middleware/karma.js @@ -114,8 +114,10 @@ var createKarmaMiddleware = function ( }) } - // serve karma.js - if (requestUrl === '/karma.js') { + // serve karma.js, context.js, and debug.js + var jsFiles = ['/karma.js', '/context.js', '/debug.js'] + var isRequestingJsFile = jsFiles.indexOf(requestUrl) !== -1 + if (isRequestingJsFile) { return serveStaticFile(requestUrl, response, function (data) { return data.replace('%KARMA_URL_ROOT%', urlRoot) .replace('%KARMA_VERSION%', VERSION) @@ -195,11 +197,7 @@ var createKarmaMiddleware = function ( return util.format(" '%s': '%s'", filePath, file.sha) }) - var clientConfig = '' - - if (requestUrl === '/debug.html') { - clientConfig = 'window.__karma__.config = ' + JSON.stringify(client) + ';\n' - } + var clientConfig = 'window.__karma__.config = ' + JSON.stringify(client) + ';\n' mappings = 'window.__karma__.files = {\n' + mappings.join(',\n') + '\n};\n' diff --git a/static/context.html b/static/context.html index 1269eea7c..2da2d0d52 100644 --- a/static/context.html +++ b/static/context.html @@ -15,14 +15,11 @@ to have already been created so they can insert their magic into it. For example, if loaded before body, Angular Scenario test framework fails to find the body and crashes and burns in an epic manner. --> + +