Test-More / Test2-Harness

Alternative to Test::Harness
Other
23 stars 26 forks source link

yath test --env-var ... does not affect --preload #274

Closed wolfsage closed 6 months ago

wolfsage commented 6 months ago

Maybe this is intentional, but yath test's --env-var does not apply before --preloads are loaded. This makes it hard to change things on the fly when using preloads and --env-var.

exodist commented 6 months ago

--env-var was added as a way to set env vars for tests that had to run as forks off of an already preloaded process when it was too late to set them the normal way. When launching a preload you can just do MY_ENV_VAR=XXX yath start ... and --env-var is not needed. But since tests run off of a preload are forked from the preloaded process, not the yath start process, --env-var was added to provide a way to set env vars in that case.

That said, I suspect yath 2.0 (not released yet, but in progress) "fixes" this anyway, --env-var probably works for yath start with the way it has been re-written.

wolfsage commented 6 months ago

Works for me, thanks. Just surprising until I figured out what was going on! :)