mirror of
https://github.com/discourse/discourse.git
synced 2025-09-08 12:06:51 +08:00
improve QUNIT support for autospec
This commit is contained in:
parent
dfe1174137
commit
a5fc51a967
3 changed files with 16 additions and 7 deletions
|
@ -145,7 +145,7 @@ class Autospec::Manager
|
||||||
# try focus tag
|
# try focus tag
|
||||||
if failed_specs.length > 0
|
if failed_specs.length > 0
|
||||||
filename,_ = failed_specs[0].split(":")
|
filename,_ = failed_specs[0].split(":")
|
||||||
if filename
|
if filename && File.exist?(filename)
|
||||||
spec = File.read(filename)
|
spec = File.read(filename)
|
||||||
start,_ = spec.split(/\S*#focus\S*$/)
|
start,_ = spec.split(/\S*#focus\S*$/)
|
||||||
if start.length < spec.length
|
if start.length < spec.length
|
||||||
|
|
|
@ -9,8 +9,8 @@ module Autospec
|
||||||
def watchers; WATCHERS; end
|
def watchers; WATCHERS; end
|
||||||
|
|
||||||
# Discourse specific
|
# Discourse specific
|
||||||
watch(%r{^app/assets/javascripts/discourse/(.+)\.js.es6$}) { |m| "test/javascripts/#{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{^app/assets/javascripts/admin/(.+)\.js.es6$}) { |m| "test/javascripts/admin/#{m[1]}-test.js.es6" }
|
||||||
watch(%r{^test/javascripts/.+\.js.es6$})
|
watch(%r{^test/javascripts/.+\.js.es6$})
|
||||||
|
|
||||||
RELOADERS = Set.new
|
RELOADERS = Set.new
|
||||||
|
@ -54,9 +54,15 @@ module Autospec
|
||||||
|
|
||||||
qunit_url = "http://localhost:#{port}/qunit"
|
qunit_url = "http://localhost:#{port}/qunit"
|
||||||
|
|
||||||
if specs != "spec" && specs.split.length == 1
|
if specs != "spec"
|
||||||
module_name = try_to_find_module_name(specs.strip)
|
module_or_filename, test_id, _name = specs.strip.split(":::")
|
||||||
qunit_url << "?module=#{module_name}" if module_name
|
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
|
end
|
||||||
|
|
||||||
cmd = "phantomjs #{Rails.root}/lib/autospec/run-qunit.js \"#{qunit_url}\""
|
cmd = "phantomjs #{Rails.root}/lib/autospec/run-qunit.js \"#{qunit_url}\""
|
||||||
|
@ -143,6 +149,9 @@ module Autospec
|
||||||
if m = /module\(['"]([^'"]+)/i.match(line)
|
if m = /module\(['"]([^'"]+)/i.match(line)
|
||||||
return m[1]
|
return m[1]
|
||||||
end
|
end
|
||||||
|
if m = /moduleForWidget\(['"]([^"']+)/i.match(line)
|
||||||
|
return "widget:#{m[1]}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ widgetTest('basics', {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
widgetTest('basics - minmized', {
|
widgetTest('basics - minimized', {
|
||||||
template: '{{mount-widget widget="home-logo" args=args}}',
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
||||||
setup() {
|
setup() {
|
||||||
this.siteSettings.logo_url = bigLogo;
|
this.siteSettings.logo_url = bigLogo;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue