improve QUNIT support for autospec

This commit is contained in:
Sam 2017-05-01 11:34:01 -04:00
parent dfe1174137
commit a5fc51a967
3 changed files with 16 additions and 7 deletions

View File

@ -145,7 +145,7 @@ class Autospec::Manager
# try focus tag
if failed_specs.length > 0
filename,_ = failed_specs[0].split(":")
if filename
if filename && File.exist?(filename)
spec = File.read(filename)
start,_ = spec.split(/\S*#focus\S*$/)
if start.length < spec.length

View File

@ -9,8 +9,8 @@ module Autospec
def watchers; WATCHERS; end
# Discourse specific
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{^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
@ -54,9 +54,15 @@ module Autospec
qunit_url = "http://localhost:#{port}/qunit"
if specs != "spec" && specs.split.length == 1
module_name = try_to_find_module_name(specs.strip)
qunit_url << "?module=#{module_name}" if module_name
if specs != "spec"
module_or_filename, test_id, _name = specs.strip.split(":::")
module_name = module_or_filename
if !test_id
module_name = try_to_find_module_name(module_or_filename)
qunit_url << "?module=#{module_name}" if module_name
else
qunit_url << "?testId=#{test_id}"
end
end
cmd = "phantomjs #{Rails.root}/lib/autospec/run-qunit.js \"#{qunit_url}\""
@ -143,6 +149,9 @@ module Autospec
if m = /module\(['"]([^'"]+)/i.match(line)
return m[1]
end
if m = /moduleForWidget\(['"]([^"']+)/i.match(line)
return "widget:#{m[1]}"
end
end
end

View File

@ -25,7 +25,7 @@ widgetTest('basics', {
}
});
widgetTest('basics - minmized', {
widgetTest('basics - minimized', {
template: '{{mount-widget widget="home-logo" args=args}}',
setup() {
this.siteSettings.logo_url = bigLogo;