Skip to content

Commit

Permalink
fix multiple tests reusing suite names
Browse files Browse the repository at this point in the history
  • Loading branch information
kolodny committed Jan 25, 2024
1 parent 3950ee2 commit 867e238
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { state } from './state';
import { isInNode } from './is-in-node';

const seen = new Set<string>();
const seen = state.seen;
const createId = (name: string, parent: string) => {
const separator = parent ? ' ' : '';
const concat = `${parent}${separator}${name}`;
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const bootstrap = async (args: BootstrapArgs): Promise<any> => {
Promise.resolve().then(async () => {
for (const k of known) {
state.tests = {};
state.seen.clear();
await importer(k);
await (window as any).waitForSafetestReady;
const tests = Object.keys(state.tests);
Expand Down
2 changes: 2 additions & 0 deletions src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface State {
__filename?: string;
activeTest?: string;
pendingExpects: Record<string, number>;
seen: Set<string>;
options: RenderOptions;
isGlobalSetupTeardownRegistered: boolean;
debugging: Set<string>;
Expand Down Expand Up @@ -55,6 +56,7 @@ export const state: State = {
tests: {},
retryMap: {},
options: {},
seen: new Set(),
currentSuite: '',
currentTest: '',
isGlobalSetupTeardownRegistered: false,
Expand Down

0 comments on commit 867e238

Please sign in to comment.