You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that ReactOnRails::TestHelper.ensure_assets_compiled always reports that manifest.json is stale when running tests, even when the file exists and is up to date:
Detected the following stale generated files:
manifest.json
After investigating, I believe this is because ReactOnRails::Utils.bundle_js_file_path() does not return the correct file path for 'manifest.json', so ReactOnRails::TestHelper.ensure_assets_compiled can’t accurately check if the file exists and is up to date.
Thanks to line 89 of lib/react_on_rails/utils.rb, it will always return 'manifest.json' instead of the correct path (e.g. '/path/to/rails/public/packs-test/manifest.json'):
defself.bundle_js_file_path(bundle_name)ifusing_webpacker? && bundle_name != "manifest.json"bundle_js_file_path_from_webpacker(bundle_name)else# Default to the non-hashed name in the specified output directory, which, for legacy# React on Rails, this is the output directory picked up by the asset pipeline.File.join(ReactOnRails.configuration.generated_assets_dir,bundle_name)endend
The text was updated successfully, but these errors were encountered:
…#1012)
* Fix Utils.bundle_js_file_path for manifest.json in webpacker projects
Utils.bundle_js_file_path was incorrectly returning
`'manifest.json'`
instead of, say,
`'/path/to/rails/public/packs/manifest.json'`
Fixes#1011
* Make issue link explicit
…#1012)
* Fix Utils.bundle_js_file_path for manifest.json in webpacker projects
Utils.bundle_js_file_path was incorrectly returning
`'manifest.json'`
instead of, say,
`'/path/to/rails/public/packs/manifest.json'`
Fixes#1011
* Make issue link explicit
I noticed that
ReactOnRails::TestHelper.ensure_assets_compiled
always reports thatmanifest.json
is stale when running tests, even when the file exists and is up to date:After investigating, I believe this is because
ReactOnRails::Utils.bundle_js_file_path()
does not return the correct file path for'manifest.json'
, soReactOnRails::TestHelper.ensure_assets_compiled
can’t accurately check if the file exists and is up to date.Thanks to line 89 of
lib/react_on_rails/utils.rb
, it will always return'manifest.json'
instead of the correct path (e.g.'/path/to/rails/public/packs-test/manifest.json'
):So in summary:
Problem:
ReactOnRails::Utils.bundle_js_file_path('manifest.json')
returns
'manifest.json'
Expected:
ReactOnRails::Utils.bundle_js_file_path('manifest.json')
returns
'/path/to/rails/public/packs-test/manifest.json'
Proposed Solution:
Change
ReactOnRails::Utils.bundle_js_file_path
toThe text was updated successfully, but these errors were encountered: