Skip to content

Commit

Permalink
fix: fix duplication of test runs depending on threads for Jest.
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel.butuzov committed Dec 12, 2024
1 parent a08caaa commit 651b19a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions testit-adapter-jest/src/globalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export default async (globalConfig: Config.GlobalConfig, projectConfig: Config.P
await strategy.setup();
const testRunId = await strategy.testRunId;

projectConfig.globals["testRunId"] = testRunId;
globalThis.strategy = strategy;
projectConfig.testEnvironmentOptions["testRunId"] = testRunId;
projectConfig.testEnvironmentOptions["adapterMode"] = 1;
};
10 changes: 2 additions & 8 deletions testit-adapter-jest/src/testitEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,8 @@ export default class TestItEnvironment extends NodeEnvironment {
super(jestConfig, jestContext);
const config = new ConfigComposer().compose(jestConfig.projectConfig.testEnvironmentOptions);

const testRunId = jestConfig.projectConfig.globals["testRunId"];

if (!testRunId || typeof testRunId !== "string") {
throw new Error("Looks like globalSetup was not called");
}

this.additions = new Additions({ ...config, testRunId });
this.strategy = StrategyFactory.create({ ...config, testRunId });
this.additions = new Additions(config);
this.strategy = StrategyFactory.create(config);

this.testPath = excludePath(jestContext.testPath, jestConfig.globalConfig.rootDir);
}
Expand Down

0 comments on commit 651b19a

Please sign in to comment.