Skip to content

Commit dafd6ba

Browse files
committed
Address test isolation and output formatting concerns
* Reset env vars and state object in configSteps beforeEach for test isolation * Added better formatting for the test output Signed-off-by: Marko Mlakar <marko.mlakar@dynatrace.com>
1 parent 01228f8 commit dafd6ba

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import type { State, Steps } from './state';
33
import { CacheOption, getConfig, ResolverType } from '../../lib/configuration';
44
import { mapValueToType } from './utils';
55

6+
const originalEnv = { ...process.env };
7+
68
export const configSteps: Steps = (state: State) => {
79
function mapName(name: string): string {
810
switch (name) {
@@ -16,6 +18,9 @@ export const configSteps: Steps = (state: State) => {
1618
return ({ given, when, then }: StepsDefinitionCallbackOptions) => {
1719
beforeEach(() => {
1820
state.options = {};
21+
state.config = undefined;
22+
state.events = [];
23+
process.env = { ...originalEnv };
1924
});
2025
given(/^an option "(.*)" of type "(.*)" with value "(.*)"$/, (name: string, type: string, value: string) => {
2126
state.options[mapName(name)] = mapValueToType(value, type);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ describe('config', () => {
1414
autoBindSteps(
1515
loadFeatures(CONFIG_FEATURE, {
1616
scenarioNameTemplate: (vars) => {
17-
return `${vars.scenarioTitle} (${vars.scenarioTags.join(',')} ${vars.featureTags.join(',')})`;
17+
const tags = [...vars.scenarioTags, ...vars.featureTags];
18+
return `${vars.scenarioTitle}${tags.length > 0 ? ` (${tags.join(', ')})` : ''}`;
1819
},
1920
}),
2021
[configSteps(state)],

0 commit comments

Comments
 (0)