diff --git a/lib/autospec/manager.rb b/lib/autospec/manager.rb index 4f9089c9dc7..8421f9d7139 100644 --- a/lib/autospec/manager.rb +++ b/lib/autospec/manager.rb @@ -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 diff --git a/lib/autospec/qunit_runner.rb b/lib/autospec/qunit_runner.rb index 9af578c7f5f..53836c4a799 100644 --- a/lib/autospec/qunit_runner.rb +++ b/lib/autospec/qunit_runner.rb @@ -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 diff --git a/test/javascripts/widgets/home-logo-test.js.es6 b/test/javascripts/widgets/home-logo-test.js.es6 index e2acb503824..2e9b09d0605 100644 --- a/test/javascripts/widgets/home-logo-test.js.es6 +++ b/test/javascripts/widgets/home-logo-test.js.es6 @@ -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;