Skip to content

Commit

Permalink
Merge pull request #1665 from bejewel-kyoungmin/fix-reset-env-correctly
Browse files Browse the repository at this point in the history
test(@nestjs/config) reset env correctly
  • Loading branch information
kamilmysliwiec authored Mar 22, 2024
2 parents 7a7dc4d + 6498d2b commit 6b68c92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions tests/e2e/cache.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ describe('Cache', () => {
let app: INestApplication;
let envBackup: NodeJS.ProcessEnv;
beforeAll(() => {
envBackup = process.env;
envBackup = {
...process.env,
};
});
describe('without cache', () => {
beforeAll(async () => {
Expand Down Expand Up @@ -56,7 +58,9 @@ describe('Cache', () => {
});

afterEach(async () => {
process.env = envBackup;
process.env = {
...envBackup,
};
await app.close();
});
});
8 changes: 6 additions & 2 deletions tests/e2e/load-priority.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ describe('Environment variables and .env files', () => {
let app: INestApplication;
let envBackup: NodeJS.ProcessEnv;
beforeAll(() => {
envBackup = process.env;
envBackup = {
...process.env,
};
});
describe('without conflicts', () => {
beforeAll(async () => {
Expand Down Expand Up @@ -65,7 +67,9 @@ describe('Environment variables and .env files', () => {
});

afterEach(async () => {
process.env = envBackup;
process.env = {
...envBackup,
};
await app.close();
});
});

0 comments on commit 6b68c92

Please sign in to comment.