Skip to content

Commit e7d0ce9

Browse files
Merge pull request rails#49931 from jonathanhefner/javascript_package_test-update-all
Update `JavascriptPackageTest` tests
2 parents febd21d + 28e976b commit e7d0ce9

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

actioncable/test/javascript_package_test.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@
44

55
class JavascriptPackageTest < ActiveSupport::TestCase
66
def test_compiled_code_is_in_sync_with_source_code
7-
compiled_file = File.expand_path("../app/assets/javascripts/action_cable.js", __dir__)
7+
compiled_files = %w[
8+
app/assets/javascripts/actioncable.js
9+
app/assets/javascripts/actioncable.esm.js
10+
app/assets/javascripts/action_cable.js
11+
].map do |file|
12+
Pathname(file).expand_path("#{__dir__}/..")
13+
end
814

9-
assert_no_changes -> { File.read(compiled_file) } do
10-
system "yarn build"
15+
assert_no_changes -> { compiled_files.map(&:read) } do
16+
system "yarn build", exception: true
1117
end
1218
end
1319
end

actionview/test/javascript_package_test.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
class JavascriptPackageTest < ActiveSupport::TestCase
44
def test_compiled_code_is_in_sync_with_source_code
5-
assert_no_changes -> {
6-
%w[
7-
app/assets/javascripts/rails-ujs.js
8-
app/assets/javascripts/rails-ujs.esm.js
9-
].map { |compiled_file|
10-
File.read(File.expand_path("../#{compiled_file}", __dir__))
11-
}
12-
} do
13-
system "yarn build"
5+
compiled_files = %w[
6+
app/assets/javascripts/rails-ujs.js
7+
app/assets/javascripts/rails-ujs.esm.js
8+
].map do |file|
9+
Pathname(file).expand_path("#{__dir__}/..")
10+
end
11+
12+
assert_no_changes -> { compiled_files.map(&:read) } do
13+
system "yarn build", exception: true
1414
end
1515
end
1616
end

activestorage/test/javascript_package_test.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44

55
class JavascriptPackageTest < ActiveSupport::TestCase
66
def test_compiled_code_is_in_sync_with_source_code
7-
compiled_file = File.expand_path("../app/assets/javascripts/activestorage.js", __dir__)
7+
compiled_files = %w[
8+
app/assets/javascripts/activestorage.js
9+
app/assets/javascripts/activestorage.esm.js
10+
].map do |file|
11+
Pathname(file).expand_path("#{__dir__}/..")
12+
end
813

9-
assert_no_changes -> { File.read(compiled_file) } do
10-
system "yarn build"
14+
assert_no_changes -> { compiled_files.map(&:read) } do
15+
system "yarn build", exception: true
1116
end
1217
end
1318
end

0 commit comments

Comments
 (0)