lukeed/uvu

`process.env` values are getting lost

faustbrian opened this issue · 1 comments

Currently running into an issue where uvu seems to lose track of variables added to process.env. Not sure if this intended because I couldn't find any mention of it.

This fails because process.env.MY_VAR is empty inside someFunction

test("something with process.env", async () => {
    process.env.MY_VAR = "dummy";

    assert.is(someFunction().key, process.env.MY_VAR);
});

someFunction requires a file that looks something like the following

export const defaults = {
    key: process.env.MY_VAR,
};

Is there any way to preserve them? If I run MY_VAR=dummy uvu then the value is available in all tests as expected but I have different values in different tests so would need to be able to set it inside of specific tests without it getting lost.

have you solved it? @faustbrian