Compile packs before run test

Sometimes `test_scaffold_tests_pass_by_default` test fails in CI.
https://travis-ci.org/rails/rails/jobs/457621750#L2095-L2120
It seems `manifest.json` was broken.

`webpacker` will compile automatically if packs is not compiled.
If parallel test is enabled, it seems that this compilation process is
executed simultaneously in multiple processes, and it may become an
inconsistent state.
In order to avoid this, compile before running the test.
This commit is contained in:
yuuji.yaginuma 2018-11-22 18:20:28 +09:00
parent f8bd01cdd9
commit 6d854f9d07
1 changed files with 4 additions and 1 deletions

View File

@ -160,7 +160,10 @@ module ApplicationTests
def test_scaffold_tests_pass_by_default
rails "generate", "scaffold", "user", "username:string", "password:string"
with_rails_env("test") { rails("db:migrate") }
with_rails_env("test") do
rails("db:migrate")
rails("webpacker:compile")
end
output = rails("test")
assert_match(/7 runs, 9 assertions, 0 failures, 0 errors/, output)