Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Rails tests no longer compiles test assets unless NODE_ENV is set to "test" #2927

Closed
lserman opened this issue Feb 12, 2021 · 2 comments

Comments

@lserman
Copy link

lserman commented Feb 12, 2021

On an older app I use the code mentioned here: #360 to precompile my test assets (Webpacker.compile)

Starting a new app today off 6.0.0.beta.2 and the same no longer works. I think it is because this line: https://github.com/rails/webpacker/blob/master/lib/tasks/webpacker/compile.rake#L23 uses the production environment if NODE_ENV is unset, while in older versions it uses Webpacker.env (which is based on RAILS_ENV instead, and is correctly set to "test" in my case).

I'm not sure which environment we should trust, so maybe relying on NODE_ENV is fine. Just took me by surprise today and I had to dig around in source code to figure it out. Setting NODE_ENV=test fixed the problem.

@rossta
Copy link
Member

rossta commented Feb 12, 2021

@lserman Could you explain in more detail how to reproduce the issue? I don't understand from your description.

@rossta
Copy link
Member

rossta commented Feb 19, 2021

For more info, I've created a branch in a demo app on Webpacker 6 that runs Rails system tests without any Webpacker-specific configuration. Webpacker precompiles as expected when I run system tests. I don't have enough info from your description to understand how to reproduce the issue you're have.

https://github.com/rossta/webpacker-6.0.0.beta-pdfjs-demo/compare/chore/rspec

@dhh dhh closed this as completed Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants