Skip to content

Commit

Permalink
jest fixtures and test plan support (via #1044)
Browse files Browse the repository at this point in the history
  • Loading branch information
epszaw authored Jul 4, 2024
1 parent 4689203 commit 84a31c8
Show file tree
Hide file tree
Showing 32 changed files with 892 additions and 330 deletions.
3 changes: 0 additions & 3 deletions packages/allure-cypress/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ import { last, toReversed } from "./utils.js";

export class AllureCypress {
allureRuntime: ReporterRuntime;

messagesByAbsolutePath = new Map<string, CypressMessage[]>();
runContextByAbsolutePath = new Map<string, RunContextByAbsolutePath>();

globalHooksMessages: CypressMessage[] = [];

constructor(config?: Config) {
Expand Down Expand Up @@ -76,7 +74,6 @@ export class AllureCypress {
specMessages.forEach((message, i) => {
// we add cypressTestId to messages where it's possible because the field is very useful to glue data
// @ts-ignore
// const {cypressTestId} = message.data
const previousMessagesSlice = specMessages.slice(0, i);
const lastHookMessage = toReversed(previousMessagesSlice).find(
({ type }) => type === "cypress_hook_start" || type === "cypress_hook_end",
Expand Down
9 changes: 1 addition & 8 deletions packages/allure-jest/src/AllureJestTestRuntime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { JestExpect } from "@jest/expect";
import type { Global } from "@jest/types";
import type { RuntimeMessage } from "allure-js-commons/sdk";
import { MessageTestRuntime } from "allure-js-commons/sdk/runtime";
Expand All @@ -14,13 +13,7 @@ export class AllureJestTestRuntime extends MessageTestRuntime {
}

async sendMessage(message: RuntimeMessage) {
const { currentTestName, currentConcurrentTestName } = (this.context.expect as JestExpect).getState();
const testName = currentTestName || currentConcurrentTestName?.();

this.jestEnvironment.handleAllureRuntimeMessage({
currentTestName: testName as string,
message,
});
this.jestEnvironment.handleAllureRuntimeMessage(message);

await Promise.resolve();
}
Expand Down
Loading

0 comments on commit 84a31c8

Please sign in to comment.