Skip to content

A platform for community discussion. Free, open, simple.

DEV: Infer plugin target from bare plugin dir in bin/qunit (#44664)

Jarek Radosz1c0a58493143
diff --git a/bin/qunit b/bin/qunit
index 55424de8822..801b9cd1e83 100755
--- a/bin/qunit
+++ b/bin/qunit
@@ -621,7 +621,7 @@ class QunitRunner
end
def target_from_path(path)
- match = path.match(%r{(?:^|/)plugins/([^/]+)/})
+ match = path.match(%r{(?:^|/)plugins/([^/]+)(?:/|\z)})
return "core" unless match
resolve_plugin_namespace(match[1])
diff --git a/spec/tasks/qunit_cli_spec.rb b/spec/tasks/qunit_cli_spec.rb
index c086da8917e..c0c20eb1ae0 100644
--- a/spec/tasks/qunit_cli_spec.rb
+++ b/spec/tasks/qunit_cli_spec.rb
@@ -177,6 +177,13 @@ describe "bin/qunit" do
)
end
+ it "targets the plugin when given a plugin directory without a trailing slash" do
+ result = run("plugins/chat")
+ expect(result.status).to eq(0)
+ expect(result.args).to include("target=chat&testem=1")
+ expect(result.env).to include("LOAD_PLUGINS" => "1")
+ end
+
it "prevents running files from multiple targets" do
result = run(core_test_file, chat_test_file)
expect(result.status).to eq(1)