Run feature specs prebuild with unset Webpack env#6397
Conversation
**Why**: Avoid potential conflicts for... 1. Environment variables which can affect intended build output expecting Webpack dev server 2. False negatives for Make "nothing to do" if environment variable would impact build artifact Previously: #6392 changelog: Internal, Automated Testing, Improve developer ergonomics for running JavaScript-enabled integration specs
|
Only downside is that this seems to be called multiple times when running multiple spec files so doing something like example |
Maybe we switch to |
|
Hm, yeah, the hope was that it would only run once for the entire test run. If Edit: Updated in 25a4db2. |
So that it's run only once for all tests Co-Authored-By: Zach Margolis <zbmargolis@gmail.com> Co-Authored-By: Sheldon Bachstein <bachsteinsk@gmail.com>
spec/rails_helper.rb
Outdated
|
|
||
| if !ENV['CI'] | ||
| config.before(:all, js: true) do | ||
| config.before(:suite, js: true) do |
There was a problem hiding this comment.
Just noticed this warning when run locally:
WARNING:
:suitehooks do not support metadata since they apply to the suite as a whole rather than any individual example or example group that has metadata. The metadata you have provided ([{:js=>true}]) will be ignored.
Unfortunate, since it's rather wasteful to run the Webpack build if not concerned with JavaScript-enabled feature specs 🤔 I wonder if there's another way to apply it at per-spec/group level, but only run once. Global var? 😬
| config.before(:suite, js: true) do | |
| config.before(js: true) do | |
| next if defined?($ran_webpack_build) | |
| $ran_webpack_build = true |
There was a problem hiding this comment.
After some testing, the above suggestion does seem to work as expected. Obviously globals are gross, so happy to apply any alternative ideas, but otherwise will move forward with this.
There was a problem hiding this comment.
Yeah this seems fine for now, better to fix the issue
Why: Avoid potential conflicts for...
Previously: #6392
Slack context: https://gsa-tts.slack.com/archives/C0NGESUN5/p1653077779604529