-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(allure-mocha): fix test result overwritten when a test is skipped…
- Loading branch information
Showing
6 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/allure-mocha/test/fixtures/samples/labels/skippedAtRuntime.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// cjs: const { it } = require("mocha"); | ||
// cjs: const { tag } = require("allure-js-commons"); | ||
// esm: import { it } from "mocha"; | ||
// esm: import { tag } from "allure-js-commons"; | ||
|
||
it("a skipped test with a tag", async function () { | ||
await tag("foo"); | ||
this.skip(); | ||
}); |
9 changes: 9 additions & 0 deletions
9
packages/allure-mocha/test/fixtures/samples/legacy/labels/skippedAtRuntime.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// cjs: const { it } = require("mocha"); | ||
// cjs: const { allure } = require("allure-mocha/runtime"); | ||
// esm: import { it } from "mocha"; | ||
// esm: import { allure } from "allure-mocha/runtime"; | ||
|
||
it("a skipped test with a tag", function () { | ||
allure.tag("foo"); | ||
this.skip(); | ||
}); |
16 changes: 16 additions & 0 deletions
16
packages/allure-mocha/test/spec/defects/dynamicSkip.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { expect, it } from "vitest"; | ||
import { issue } from "allure-js-commons"; | ||
import { runMochaInlineTest } from "../../utils.js"; | ||
|
||
it("shouldn't overwrite the result of a dynamically skipped test", async () => { | ||
await issue("457"); | ||
|
||
const { tests } = await runMochaInlineTest(["labels", "skippedAtRuntime"], ["legacy", "labels", "skippedAtRuntime"]); | ||
|
||
expect(tests).toHaveLength(2); | ||
for (const test of tests) { | ||
expect(test).toMatchObject({ | ||
labels: expect.arrayContaining([expect.objectContaining({ name: "tag", value: "foo" })]), | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters