Skip to content

Commit 17f12da

Browse files
committed
Remove direct reassignment of the env variables and redundant test timeout for the unit test
Signed-off-by: Marko Mlakar <[email protected]>
1 parent c9e41b7 commit 17f12da

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

libs/providers/flagd/src/e2e/step-definitions/configSteps.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@ export const configSteps: Steps = (state: State) => {
1414
}
1515

1616
return ({ given, when, then }: StepsDefinitionCallbackOptions) => {
17-
const originalEnv = process.env;
1817
beforeEach(() => {
1918
state.options = {};
2019
state.config = undefined;
2120
state.events = [];
22-
process.env = { ...originalEnv };
21+
const originalEnv = { ...process.env };
22+
Object.keys(process.env).forEach((key) => delete process.env[key]);
23+
Object.assign(process.env, originalEnv);
2324
});
2425

25-
afterEach(() => {
26-
process.env = originalEnv;
27-
});
2826
given(/^an option "(.*)" of type "(.*)" with value "(.*)"$/, (name: string, type: string, value: string) => {
2927
state.options[mapName(name)] = mapValueToType(value, type);
3028
});

libs/providers/flagd/src/e2e/tests/config.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { State } from '../step-definitions/state';
33
import { autoBindSteps, loadFeatures } from 'jest-cucumber';
44
import { CONFIG_FEATURE } from '../constants';
55

6-
jest.setTimeout(50000);
76
describe('config', () => {
87
const state: State = {
98
resolverType: 'in-process',

0 commit comments

Comments
 (0)