diff --git a/lib/autospec/qunit_runner.rb b/lib/autospec/qunit_runner.rb index 06d3e236235..9af578c7f5f 100644 --- a/lib/autospec/qunit_runner.rb +++ b/lib/autospec/qunit_runner.rb @@ -9,17 +9,17 @@ module Autospec def watchers; WATCHERS; end # Discourse specific - watch(%r{^app/assets/javascripts/discourse/(.+)\.js$}) { |m| "test/javascripts/#{m[1]}_test.js" } - watch(%r{^app/assets/javascripts/admin/(.+)\.js$}) { |m| "test/javascripts/admin/#{m[1]}_test.js" } - watch(%r{^test/javascripts/.+\.js$}) + watch(%r{^app/assets/javascripts/discourse/(.+)\.js.es6$}) { |m| "test/javascripts/#{m[1]}_test.js.es6" } + watch(%r{^app/assets/javascripts/admin/(.+)\.js.es6$}) { |m| "test/javascripts/admin/#{m[1]}_test.js.es6" } + watch(%r{^test/javascripts/.+\.js.es6$}) RELOADERS = Set.new def self.reload(pattern); RELOADERS << pattern; end def reloaders; RELOADERS; end # Discourse specific - reload(%r{^test/javascripts/fixtures/.+_fixtures\.js$}) - reload(%r{^test/javascripts/(helpers|mixins)/.+\.js$}) + reload(%r{^test/javascripts/fixtures/.+_fixtures\.js(\.es6)?$}) + reload(%r{^test/javascripts/(helpers|mixins)/.+\.js(\.es6)?$}) reload("test/javascripts/test_helper.js") require "socket" @@ -137,6 +137,7 @@ module Autospec end def try_to_find_module_name(file) + file,_ = file.split(/:\d+$/) return unless File.exists?(file) File.open(file, "r").each_line do |line| if m = /module\(['"]([^'"]+)/i.match(line) diff --git a/lib/autospec/run-qunit.js b/lib/autospec/run-qunit.js index a4a851822e1..54635bc399d 100644 --- a/lib/autospec/run-qunit.js +++ b/lib/autospec/run-qunit.js @@ -32,7 +32,9 @@ page.onConsoleMessage = function (message) { page.onCallback = function (message) { // write to the result file - if (message.slice(0, 5) === "FILE:") { fs.write(QUNIT_RESULT, message.slice(6), "a"); } + if (message.slice(0, 5) === "FAIL:") { + fs.write(QUNIT_RESULT, message.slice(6) + "\n", "a"); + } // forward the message to the standard output if (message.slice(0, 6) === "PRINT:") { system.stdout.write(message.slice(7)); } }; @@ -131,12 +133,7 @@ function logQUnit() { if (!errors[module][test]) { errors[module][test] = []; } errors[module][test].push(assertion); - var fileName = context.source - .replace(/[^\S\n]+at[^\S\n]+/g, "") - .split("\n")[1] - .replace(/\?.+$/, "") - .replace(/^.+\/assets\//, "test/javascripts/"); - window.callPhantom("FILE: " + fileName + " "); + window.callPhantom("FAIL: " + context.module + ":::" + context.testId + ":::" + context.name); } });