Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add "pid" to log info with test result #976

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/reporters/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ exports.formatTestInfo = test => {
const suiteName = test.fullTitle().replace(test.title, "");
const sessionId = test.sessionId ? `:${test.sessionId}` : "";
const reason = test.pending && ` reason: ${chalk.red(getSkipReason(test) || "no comment")}`;
const pid = test.meta?.pid ? `, pid:${test.meta.pid}` : "";

return (
` ${suiteName}${chalk.underline(test.title)} [${chalk.yellow(test.browserId)}` +
`${sessionId}] - ${chalk.cyan(test.duration || 0)}ms${reason || ""}`
`${sessionId}${pid}] - ${chalk.cyan(test.duration || 0)}ms${reason || ""}`
);
};

Expand Down
17 changes: 14 additions & 3 deletions test/src/reporters/flat.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,26 @@ describe("Flat reporter", () => {
TEST_FAIL: "failed",
};

it("should correctly do the rendering", async () => {
test = mkTestStub_({ sessionId: "test_session" });
it("should render session id", async () => {
test = mkTestStub_({ sessionId: "500100" });

await createFlatReporter();
emit(RunnerEvents.TEST_PASS, test);

const result = getDeserializedResult(informer.log.firstCall.args[0]);

assert.equal(result, "suite test [chrome:test_session] - 100500ms");
assert.equal(result, "suite test [chrome:500100] - 100500ms");
});

it("should render pid", async () => {
test = mkTestStub_({ meta: { pid: "12345" } });

await createFlatReporter();
emit(RunnerEvents.TEST_PASS, test);

const result = getDeserializedResult(informer.log.firstCall.args[0]);

assert.equal(result, "suite test [chrome, pid:12345] - 100500ms");
});

describe("skipped tests report", () => {
Expand Down
Loading