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
Describe your issue:
There's an issue with jest where it does not properly pass along the process.env value when calling spawn. This is because jest sandboxes and isolates a copy of process.env which means that any changes to process.env made inside of a test setup script, for example, will not be reflected in subprocess environment. One simple way to resolve this is to just explicitly pass process.env to the spawn call.
import{prepareEnvironment}from'@gmrchk/cli-testing-library';process.env.COOL_ENV_VAR='foo';it('program',async()=>{const{ cleanup, exec path}=awaitprepareEnvironment();const{ stdout }=awaitexec('printenv');console.log(stdout);// COOL_ENV_VAR is not thereawaitcleanup();});
Before creating this issue, did you think of...:
Have you checked closed issues for similar/related problems?
Have you provided all helpful information available?
Have you considered creating a demo repository, or a link to your running project where the problem is reproducible?
The text was updated successfully, but these errors were encountered:
Describe your issue:
There's an issue with
jest
where it does not properly pass along theprocess.env
value when callingspawn
. This is because jest sandboxes and isolates a copy ofprocess.env
which means that any changes toprocess.env
made inside of a test setup script, for example, will not be reflected in subprocess environment. One simple way to resolve this is to just explicitly passprocess.env
to thespawn
call.Relevant Jest issue here.
The code of the library usage:
Before creating this issue, did you think of...:
The text was updated successfully, but these errors were encountered: