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

refactor(@jest/reporters): improve annotation formatting of GitHubActionsReporter #12826

Merged
merged 22 commits into from
May 9, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix filename
mrazauskas committed May 9, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit ebd0bf8818292e4eedcbb2ec63520d596383f1de
6 changes: 3 additions & 3 deletions packages/jest-reporters/src/GitHubActionsReporter.ts
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ export default class GitHubActionsReporter extends BaseReporter {
static readonly filename = __filename;

override onTestCaseResult(
test: Test,
_test: Test,
{failureMessages, ancestorTitles, title}: TestCaseResult,
): void {
failureMessages.forEach(failureMessage => {
@@ -38,14 +38,14 @@ export default class GitHubActionsReporter extends BaseReporter {
);

this.log(
`\n::error file=${test.path},line=${topFrame?.line},title=${errorTitle}::${errorMessage}`,
`\n::error file=${topFrame?.file},line=${topFrame?.line},title=${errorTitle}::${errorMessage}`,
);
});
}
}

// copied from: https://github.com/actions/toolkit/blob/main/packages/core/src/command.ts
function normalizeMessage(input: string): string {
// copied from: https://github.com/actions/toolkit/blob/main/packages/core/src/command.ts
const normalizedInput = input
.replace(/%/g, '%25')
.replace(/\r/g, '%0D')
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
exports[`passes test case report to '@actions/core' when a test has reference error 1`] = `
Array [
"
::error file=/user/project/__tests__/example.test.js:25:12,line=25,title=some test::ReferenceError: abc is not defined%0A%0A at Object.abc (__tests__/example.test.js:25:12)
::error file=/user/project/__tests__/example.test.js,line=25,title=some test::ReferenceError: abc is not defined%0A%0A at Object.abc (__tests__/example.test.js:25:12)
",
]
`;