-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
76 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import MochaAllureReporter from "allure-mocha"; | ||
import glob from "glob"; | ||
import Mocha from "mocha"; | ||
import "source-map-support/register"; | ||
|
||
const mocha = new Mocha({ | ||
timeout: 16000, | ||
reporter: MochaAllureReporter, | ||
parallel: true, | ||
}); | ||
|
||
glob.sync("test/fixtures/specs/runtime.ts").forEach((file) => mocha.addFile(file)); | ||
|
||
mocha.run((failures) => process.exit(failures === 0 ? 0 : 1)); |
13 changes: 13 additions & 0 deletions
13
packages/allure-mocha/test/fixtures/runners/singleThread.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,13 @@ | ||
import MochaAllureReporter from "allure-mocha"; | ||
import glob from "glob"; | ||
import Mocha from "mocha"; | ||
import "source-map-support/register"; | ||
|
||
const mocha = new Mocha({ | ||
timeout: 16000, | ||
reporter: MochaAllureReporter, | ||
}); | ||
|
||
glob.sync("test/fixtures/specs/runtime.ts").forEach((file) => mocha.addFile(file)); | ||
|
||
mocha.run((failures) => process.exit(failures === 0 ? 0 : 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,8 @@ | ||
import { describe, it } from "mocha"; | ||
import { allure } from "../../../runtime"; | ||
|
||
describe("runtime", () => { | ||
it("assigns label", () => { | ||
allure.label("foo", "bar"); | ||
}); | ||
}); |
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,41 @@ | ||
import { spawnSync } from "node:child_process"; | ||
import fs from "node:fs"; | ||
import process from "node:process"; | ||
import { expect } from "chai"; | ||
import { beforeEach, describe, it } from "mocha"; | ||
import { restore, stub } from "sinon"; | ||
|
||
describe("reporter", () => { | ||
beforeEach(() => { | ||
restore(); | ||
stub(fs, "mkdirSync").callsFake(() => ""); | ||
}); | ||
|
||
describe("parallel mode", () => { | ||
it("prints warnings about allure api", () => { | ||
const out = spawnSync( | ||
"ts-node", | ||
["--project", "test/tsconfig.json", "test/fixtures/runners/parallel.ts"], | ||
{ | ||
cwd: process.cwd(), | ||
}, | ||
); | ||
|
||
expect(out.stderr.toString("utf8")).contains("can't be used in parallel mode"); | ||
}); | ||
}); | ||
|
||
describe("single thread mode", () => { | ||
it("doesn't print any warning about allure api", () => { | ||
const out = spawnSync( | ||
"ts-node", | ||
["--project", "test/tsconfig.json", "test/fixtures/runners/singleThread.ts"], | ||
{ | ||
cwd: process.cwd(), | ||
}, | ||
); | ||
|
||
expect(out.stderr.toString("utf8")).not.contains("can't be used in parallel mode"); | ||
}); | ||
}); | ||
}); |