-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Errors in Rails system tests when webpack-dev-server is running #189
Comments
@renchap I see, yes I think it would make sense to have another manifest just for testing, because we simply can't avoid overwriting if two executables are running at the same time with different config. I kinda of see now the use case of environment within paths.yml so, instead of direct declaration we have it scoped per environment. Btw, why not use client side testing approach instead of Rails? I think it would be much faster and isolated. |
I am also running JS tests using Jest, but system tests allows me to test complex workflows (file uploads, multiple client-side actions, ...) and check that the database have the correct content, files are correctly processed, ... Environment-scoped |
Right I see, makes sense 👍 We had a discussion earlier in #153 about this, but that time this use case didn't occur to me. default: &default
config: config/webpack
entry: bundles
output: public
manifest: manifest.json
node_modules: node_modules
source: frontend
extensions:
- .coffee
- .js
- .jsx
- .ts
- .vue
- .sass
- .css
- .png
- .svg
- .gif
- .jpeg
development:
<<: *default
test:
<<: *default
manifest: manifest-test.json
production:
<<: *default
Yepp, sounds good to me 👍 |
We probably have to scope this on both sides with environment when reading this file. |
I also ran into some issues around this. I'd like to be able to run my automated test suite without having to run webpack-dev-server. I think that means that I'd like to be able to toggle I think that the common way to use the ENV variable would be to pass the yaml through ERB, but I'm not sure how that would play out in JS-land. I'd expect that the environment-specific config blocks would be simpler. |
Yes, I think for longer run having it scoped env wide would be easy and work well. |
@samandmoore @renchap We now have scoped/env configs for webpack 🎉 |
Awesome, thanks @gauravtiwari! |
Thanks so much for addressing this. |
@gauravtiwari @samandmoore @renchap If one is not using the hot reload server for dev, then we'll still have this issue. The only way around this would be to have the webpack config do something to identify the "test files," like adding a suffix of CC: @robwise |
@justin808 I was thinking that it would work fine because we can compile the files in the test env and read from the file system. But we could still use the dev server in development env. That just requires that the dev server files take precedence over the file system ones... which I'm not sure is the case. Hmm. |
I am using
webpack-dev-server
for development, so the packs inmanifest.json
are using it onhttp://localhost:8080/...
.I am also using Rails system tests for browser-based testing. I am running
NODE_ENV=test ./bin/webpack
before running the system tests to generate all needed assets inpublic/packs
, butmanifest.json
generated by the command is immediately overwritten by the runningwebpack-dev-server
as the change is detected.In my code, I am enabling some debug code using
NODE_ENV == development
, so when the system tests are ran I am seeing all the debug output as the assets for the tests are using the localwebpack-dev-server
and not the assets generated inpublic/packs
.@gauravtiwari do you have an idea on how to solve this? I thought about changing the manifest name to
manifest-test.json
in both webpack config and Webpacker config, but there it would be much easier if there was a Rails config option to set the manifest name (https://github.com/rails/webpacker/blob/master/lib/webpacker/configuration.rb#L19). Would this work for you?The text was updated successfully, but these errors were encountered: