Skip to content

Commit

Permalink
fix cucumberjs reporter on windows (fixes #492, via #494)
Browse files Browse the repository at this point in the history
  • Loading branch information
epszaw authored Sep 12, 2022
1 parent 3634505 commit 4122761
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/allure-cucumberjs/src/CucumberJSAllureReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,16 +232,17 @@ export class CucumberJSAllureFormatter extends Formatter {
const labels = this.parseTagsLabels(scenario?.tags || []);
const links = this.parseTagsLinks(scenario?.tags || []);
const currentTest = new AllureTest(this.allureRuntime, Date.now());
const thread = ALLURE_THREAD_NAME || process.pid.toString();

this.runningTestsMap.set(data.id, currentTest);
this.testCaseStartedMap.set(data.id, data);
this.testCaseTestStepsResults.set(data.id, []);

currentTest.name = pickle.name;
currentTest?.addLabel(LabelName.HOST, this.hostname);
currentTest?.addLabel(LabelName.THREAD, ALLURE_THREAD_NAME || process.getuid().toString());
currentTest?.addLabel(LabelName.LANGUAGE, "javascript");
currentTest?.addLabel(LabelName.FRAMEWORK, "cucumberjs");
currentTest?.addLabel(LabelName.THREAD, thread);

if (doc?.feature) {
currentTest.addLabel(LabelName.FEATURE, doc.feature.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ describe("CucumberJSAllureReporter", () => {

it("should create labels", async () => {
sinon.stub(os, "hostname").returns("127.0.0.1");
sinon.stub(process, "getuid").returns(123);

const results = await runFeatures(dataSet.withTags);
expect(results.tests).length(1);
Expand All @@ -376,7 +375,7 @@ describe("CucumberJSAllureReporter", () => {
expect(feature?.value).eq("a");
expect(suite?.value).eq("b");
expect(host?.value).eq("127.0.0.1");
expect(thread?.value).eq("123");
expect(thread?.value).eq(process.pid.toString());
expect(tags).length(2);
expect(tags[0].value).eq("@foo");
expect(tags[1].value).eq("@bar");
Expand Down

0 comments on commit 4122761

Please sign in to comment.