Skip to content

Commit

Permalink
Fix broken tests after digest shortening (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
brenogazzola authored and dhh committed May 15, 2024
1 parent c9b32dc commit c7a4355
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
var fun; //# sourceMappingURL=/assets/sourceMappingURL-already-prefixed.js.map
var fun; //# sourceMappingURL=/assets/sourceMappingURL-already-prefixed.js.map
9 changes: 6 additions & 3 deletions test/propshaft/compiler/source_mapping_urls_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ class Propshaft::Compiler::SourceMappingUrlsTest < ActiveSupport::TestCase
end

test "sourceMapURL is already prefixed with url_prefix" do
assert_match %r{//# sourceMappingURL=/assets/sourceMappingURL-already-prefixed.js-[a-z0-9]{40}\.map},
assert_match %r{//# sourceMappingURL=/assets/sourceMappingURL-already-prefixed.js-[a-z0-9]{8}\.map},
compile_asset(find_asset("sourceMappingURL-already-prefixed.js", fixture_path: "mapped"))
assert_match %r{//# sourceMappingURL=/assets/nested/sourceMappingURL-already-prefixed-nested.js-[a-z0-9]{40}\.map},
assert_match %r{//# sourceMappingURL=/assets/nested/sourceMappingURL-already-prefixed-nested.js-[a-z0-9]{8}\.map},
compile_asset(find_asset("nested/sourceMappingURL-already-prefixed-nested.js", fixture_path: "mapped"))
end

test "sourceMapURL is already prefixed with an incorrect url_prefix" do
refute_match %r{//# sourceMappingURL=thisisinvalidassets/sourceMappingURL-already-prefixed-invalid.js-[a-z0-9]{40}\.map},
refute_match %r{//# sourceMappingURL=thisisinvalidassets/sourceMappingURL-already-prefixed-invalid.js-[a-z0-9]{8}\.map},
compile_asset(find_asset("sourceMappingURL-already-prefixed-invalid.js", fixture_path: "mapped"))
end

Expand All @@ -82,3 +82,6 @@ def compile_asset(asset)
assembly.compilers.compile(asset)
end
end

# //# sourceMappingURL=/assets/sourceMappingURL-already-prefixed.js-[a-z0-9]{40}.map
# //# sourceMappingURL=/assets/sourceMappingURL-already-prefixed.js-da39a3ee.map

0 comments on commit c7a4355

Please sign in to comment.