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
Copy file name to clipboardExpand all lines: docs/testing.md
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -134,3 +134,14 @@ Make sure you configure Rails to serve static files from the public directory in
134
134
# Configure public file server for tests with Cache-Control for performance.
135
135
config.public_file_server.enabled =true
136
136
```
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