Skip to content

Commit

Permalink
test: handle process.env in config_test.ts
Browse files Browse the repository at this point in the history
The tests in #2288 can fail depending on the environment
variables on the system. This commit takes the environment out
of the equation.

Refs: #2288
  • Loading branch information
cjihrig committed Mar 5, 2025
1 parent e27eb26 commit fa91a37
Showing 1 changed file with 13 additions and 0 deletions.
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;
process.env = {};
});

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

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

0 comments on commit fa91a37

Please sign in to comment.