mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
FIX: Ensure skip-module JS is transpiled correctly (#21224)
This regressed in 7e74dd0afe
, and was causing issues with 2fa security keys on the email verification route
This commit is contained in:
parent
cd88af8876
commit
6cb733d6c7
|
@ -293,7 +293,7 @@ class DiscourseJsProcessor
|
|||
"transpile",
|
||||
source,
|
||||
{
|
||||
skip_module: @skip_module,
|
||||
skipModule: @skip_module,
|
||||
moduleId: module_name(root_path, logical_path),
|
||||
filename: logical_path || "unknown",
|
||||
themeId: theme_id,
|
||||
|
|
|
@ -35,6 +35,14 @@ RSpec.describe DiscourseJsProcessor do
|
|||
it "returns false if the header is not present" do
|
||||
expect(DiscourseJsProcessor.skip_module?("// just some JS\nconsole.log()")).to eq(false)
|
||||
end
|
||||
|
||||
it "works end-to-end" do
|
||||
source = <<~JS.chomp
|
||||
// discourse-skip-module
|
||||
console.log("hello world");
|
||||
JS
|
||||
expect(DiscourseJsProcessor.transpile(source, "test", "test")).to eq(source)
|
||||
end
|
||||
end
|
||||
|
||||
it "passes through modern JS syntaxes which are supported in our target browsers" do
|
||||
|
|
Loading…
Reference in New Issue
Block a user