Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
src: fix env var TZ test
In some CI environments the TZ env var is set. Since a .env file won't
override that, we need to create an env where the test can still run by
deleting the TZ variable.
  • Loading branch information
philnash committed Sep 8, 2023
commit 56f0868effaeae656074a67440e11fb3cae0e598
7 changes: 6 additions & 1 deletion test/parallel/test-dotenv-node-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@ describe('.env supports NODE_OPTIONS', () => {
const code = `
require('assert')(new Date().toString().includes('Hawaii'))
`.trim();
// Some CI environments set TZ. Since an env file doesn't override existing
// environment variables, we need to delete it and then pass the env object
// as the environment to spawnPromisified.
const env = { ...process.env };
delete env.TZ;
const child = await common.spawnPromisified(
process.execPath,
[ `--env-file=${relativePath}`, '--eval', code ],
{ cwd: __dirname },
{ cwd: __dirname, env },
);
assert.strictEqual(child.stderr, '');
assert.strictEqual(child.code, 0);
Expand Down