Skip to content

Commit

Permalink
feat: cypress report skipped tests - fix lint / prettier
Browse files Browse the repository at this point in the history
fixes #948
  • Loading branch information
RobertBattaglia authored and epszaw committed Jul 1, 2024
1 parent 5228b19 commit 34f0d0b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/allure-cypress/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
toReversed,
uint8ArrayToBase64,
} from "./utils.js";
import {CypressTestStartRuntimeMessage} from "../dist/model";

export class AllureCypressTestRuntime implements TestRuntime {
labels(...labels: Label[]) {
Expand Down Expand Up @@ -204,6 +205,7 @@ const {
EVENT_TEST_BEGIN,
EVENT_TEST_FAIL,
EVENT_TEST_PASS,
EVENT_TEST_PENDING,
EVENT_SUITE_BEGIN,
EVENT_SUITE_END,
EVENT_HOOK_BEGIN,
Expand Down Expand Up @@ -405,6 +407,32 @@ const initializeAllure = () => {
},
});
})
.on(EVENT_TEST_PENDING, (test: CypressTest) => {
const testRuntime = new AllureCypressTestRuntime();

const startMessage: CypressTestStartRuntimeMessage = {
type: "cypress_test_start",
data: {
id: test.id,
specPath: getSuitePath(test).concat(test.title),
filename: Cypress.spec.relative,
start: Date.now(),
},
};
const endMessage: CypressTestEndMessage = {
type: "cypress_test_end",
data: {
id: test.id,
status: Status.SKIPPED,
stop: Date.now(),
},
};

const skippedTestMessages: CypressRuntimeMessage[] = [startMessage, endMessage];
testRuntime.sendSkippedTestMessages(skippedTestMessages);

setGlobalTestRuntime(testRuntime);
})
.on(EVENT_RUN_END, () => {
// this is the only way to say reporter process messages in interactive mode without data duplication
if (Cypress.config("isInteractive")) {
Expand Down

0 comments on commit 34f0d0b

Please sign in to comment.