Fixed source maps for when test files error out. See https://github.com/brunch/brunch/issues/842

This commit is contained in:
Scott Erickson 2014-06-07 16:30:01 -07:00
parent 2cbc33d66d
commit 5104f0a1e7
3 changed files with 23 additions and 4 deletions

View file

@ -114,7 +114,7 @@
getWindowLocation: function() { return window.location; }
});
var catchingExceptions = queryString.getParam("catch");
var catchingExceptions = false; // Setting to false always for CodeCombat, because Jasmine-HTML's reporter doesn't do source maps, and Chrome console does.
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
/**

View file

@ -13,9 +13,9 @@ module.exports = class TestView extends CocoView
constructor: (options, @subPath='') ->
super(options)
@subPath = @subPath[1..] if @subPath[0] is '/'
@loadJasmine() unless TestView.loaded
@loadTestingLibs() unless TestView.loaded
loadJasmine: ->
loadTestingLibs: ->
@queue = new createjs.LoadQueue()
@queue.on('complete', @scriptsLoaded, @)
for f in ['jasmine', 'jasmine-html', 'boot', 'mock-ajax', 'test-app']
@ -102,7 +102,15 @@ module.exports = class TestView extends CocoView
jasmine.Ajax.install()
beforeEach ->
jasmine.Ajax.requests.reset()
# TODO get some setup and teardown prepped
Backbone.Mediator.init()
# TODO Stubbify more things
# * document.location
# * firebase
afterEach ->
# TODO Clean up more things
# * Events
require f for f in @specFiles # runs the tests
destroy: ->

View file

@ -76,6 +76,8 @@ exports.config =
framework: 'backbone'
plugins:
autoReload:
delay: 300 # for race conditions, particularly waiting for onCompile to do its thing
coffeelint:
pattern: /^app\/.*\.coffee$/
options:
@ -91,3 +93,12 @@ exports.config =
uglify:
output:
semicolons: false
onCompile: (files) ->
exec = require('child_process').exec
regexFrom = '\\/\\/# sourceMappingURL=([^\\/].*)\\.map'
regexTo = '\\/\\/# sourceMappingURL=\\/javascripts\\/$1\\.map'
regex = "s/#{regexFrom}/#{regexTo}/g"
for file in files
c = "perl -pi -e '#{regex}' #{file.path}"
exec c