Skip to content
Merged
Changes from all commits
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
13 changes: 13 additions & 0 deletions src/config_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,19 @@ describe('KubeConfig', () => {
});

describe('BufferOrFile', () => {
let originalEnv;

before(() => {
// The code being tested here references process.env and can fail
// if run on a machine with certain environment variable settings.
originalEnv = process.env;
Copy link

Copilot AI Mar 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assigning process.env directly to originalEnv stores a reference instead of a snapshot, which may lead to unintended side effects. Consider using a shallow copy (e.g., originalEnv = { ...process.env }) to ensure the original environment is accurately restored.

Suggested change
originalEnv = process.env;
originalEnv = { ...process.env };

Copilot uses AI. Check for mistakes.

process.env = {};
});

after(() => {
process.env = originalEnv;
});

it('should load from root if present', () => {
const data = 'some data for file';
const arg: any = {
Expand Down