Skip to content

Commit 63a5e41

Browse files
authored
Clarify rails test uses devlopment.js by default (#2721)
fixes #2654
1 parent 5780a0a commit 63a5e41

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/testing.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,14 @@ Make sure you configure Rails to serve static files from the public directory in
134134
# Configure public file server for tests with Cache-Control for performance.
135135
config.public_file_server.enabled = true
136136
```
137+
138+
## Webpacker Configuration and Rails Tests
139+
140+
Webpacker ships with three javascript configuration files: `test.js`,
141+
`development.js`, and `production.js`. The `NODE_ENV` environment
142+
variable determines which config will be used. `NODE_ENV` is
143+
independent of `RAILS_ENV` and is set to `development` by [default](https://github.com/rails/webpacker/blob/bf278f9787704ed0f78038ad7d36c008abc2edfd/lib/install/bin/webpack#L4).
144+
This means that `rails test` or `rspec` will use `development.js`
145+
by default, _not_ `test.js`.
146+
147+
For more information see [Why doesn't Webpacker use my test config when I run Rails tests?](https://rossta.net/blog/why-doesnt-webpacker-use-my-test-config-when-i-run-rails-tests.html)

0 commit comments

Comments
 (0)