mirror of https://github.com/rails/rails
Fail on error in JavascriptPackageTest for UJS
Prior to this commit, if `app/javascript/rails-ujs/index.js` contained a syntax error, `JavascriptPackageTest` would still pass because `system "yarn build"` would simply return `false` and the compiled output would not change. This commit adds `exception: true` to the `system` call so that an error will be raised if `yarn build` fails.
This commit is contained in:
parent
febd21da34
commit
859cab5607
|
@ -2,15 +2,15 @@
|
|||
|
||||
class JavascriptPackageTest < ActiveSupport::TestCase
|
||||
def test_compiled_code_is_in_sync_with_source_code
|
||||
assert_no_changes -> {
|
||||
%w[
|
||||
app/assets/javascripts/rails-ujs.js
|
||||
app/assets/javascripts/rails-ujs.esm.js
|
||||
].map { |compiled_file|
|
||||
File.read(File.expand_path("../#{compiled_file}", __dir__))
|
||||
}
|
||||
} do
|
||||
system "yarn build"
|
||||
compiled_files = %w[
|
||||
app/assets/javascripts/rails-ujs.js
|
||||
app/assets/javascripts/rails-ujs.esm.js
|
||||
].map do |file|
|
||||
Pathname(file).expand_path("#{__dir__}/..")
|
||||
end
|
||||
|
||||
assert_no_changes -> { compiled_files.map(&:read) } do
|
||||
system "yarn build", exception: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue