forked from allure-framework/allure-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report parent suites with nesting correctly
closes allure-framework#38
- Loading branch information
1 parent
9aaa78f
commit 350610a
Showing
7 changed files
with
134 additions
and
34 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { expect } from "chai"; | ||
|
||
it("top-level test", () => { | ||
expect(1).to.be.eq(1); | ||
}); | ||
|
||
describe("Parent suite", () => { | ||
it("shallow test", () => { | ||
expect(1).to.be.eq(1); | ||
}); | ||
|
||
describe("Nested suite", () => { | ||
describe("Sub suite", () => { | ||
it("child test", () => { | ||
expect(1).to.be.eq(1); | ||
}); | ||
|
||
describe("Incredibly nested suite", () => { | ||
it("the deepest test", () => { | ||
expect(1).to.be.eq(1); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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,7 @@ | ||
describe("Pending tests", () => { | ||
xit("simple pending", () => {}); | ||
|
||
it("skipped in runtime", function() { | ||
this.skip(); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { InMemoryAllureWriter, LabelName } from "allure-js-commons"; | ||
import { expect } from "chai"; | ||
import { suite } from "mocha-typescript"; | ||
import { findLabelValue, runTests } from "../utils"; | ||
|
||
@suite | ||
class NestingSupport { | ||
private writerStub!: InMemoryAllureWriter; | ||
|
||
async before() { | ||
this.writerStub = await runTests("nested"); | ||
} | ||
|
||
@test | ||
shouldAssignAllSuites() { | ||
const test = this.writerStub.getTestByName("child test"); | ||
expect(findLabelValue(test, LabelName.PARENT_SUITE)).eq("Parent suite"); | ||
expect(findLabelValue(test, LabelName.SUITE)).eq("Nested suite"); | ||
expect(findLabelValue(test, LabelName.SUB_SUITE)).eq("Sub suite"); | ||
} | ||
|
||
@test | ||
shouldSkipMissingLevels() { | ||
const test = this.writerStub.getTestByName("shallow test"); | ||
expect(findLabelValue(test, LabelName.PARENT_SUITE)).eq("Parent suite"); | ||
expect(findLabelValue(test, LabelName.SUITE)).eq(undefined); | ||
expect(findLabelValue(test, LabelName.SUB_SUITE)).eq(undefined); | ||
} | ||
|
||
@test | ||
shouldHandleTopLevelTests() { | ||
const test = this.writerStub.getTestByName("top-level test"); | ||
expect(findLabelValue(test, LabelName.PARENT_SUITE)).eq(undefined); | ||
expect(findLabelValue(test, LabelName.SUITE)).eq(undefined); | ||
expect(findLabelValue(test, LabelName.SUB_SUITE)).eq(undefined); | ||
} | ||
|
||
@test | ||
shouldMergeSubSuiteNames() { | ||
const test = this.writerStub.getTestByName("the deepest test"); | ||
expect(findLabelValue(test, LabelName.PARENT_SUITE)).eq("Parent suite"); | ||
expect(findLabelValue(test, LabelName.SUITE)).eq("Nested suite"); | ||
expect(findLabelValue(test, LabelName.SUB_SUITE)).eq("Sub suite > Incredibly nested suite"); | ||
} | ||
} |
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