Skip to content

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

@lserman

Description

@lserman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions