-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug]: GitHubActionsReporter reports error on wrong line #12906
Comments
Thanks for report. The logic of |
No worries @mrazauskas I can just wait until #12826 is out and try again :) |
Checked it. Currently the reporter sends this to GitHub: ::error file=/path/to/test.js,line=41,col=55::<long-error-message-with-stack-trace> On ::error file=/path/to/test.js,line=15,title=test › which line is the error reported?::expect(received).toStrictEqual(expected) // deep equality%0A%0A- Expected - 1%0A+ Received + 1%0A%0A@@ -1,7 +1,7 @@%0A Object {%0A- "created": 2022-06-07T03:52:29.511Z,%0A+ "created": 2022-06-07T03:52:29.411Z,%0A "environment": "production",%0A "foo": "bar",%0A "id": "12434-124455-114454",%0A "owner": "rethab",%0A "repo": "actions-test-repo",%0A%0A at Object.toStrictEqual (test.js:15:15) The line number is correct. The title is nicer and stack trace is minimal as well. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
28.1.0
Steps to reproduce
github-actions
reportercreated: Date
are not equalExpected behavior
I expect the annotation to be created on the line where the test failed, which should be based on the stack trace
Actual behavior
The GitHubActionReporter incorrectly takes parts of the date as the line number and then annotates a random line
Additional context
Repository to reproduce the problem: rethab/actions-test-repo#10
Consider this annotation:
--> The line two is clearly coming from the date. In fact it's the minute (I ran the test at 11:02). I have tested this by running it multiple times and it annotates the line based on when I run it
--> This might happen, because the reporter looks for the string
at
when trying to separate the stack from the message and finds it increated
. Perhaps this regex is wrong? https://github.com/facebook/jest/blob/24e0472ac41ea03cdd89ffaea8c5f410ecf6054f/packages/jest-message-util/src/index.ts#L403Environment
System: OS: macOS 12.3.1 CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz Binaries: Node: 16.13.2 - /usr/local/opt/node@16/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 8.1.2 - /usr/local/opt/node@16/bin/npm npmPackages: jest: ^28.1.0 => 28.1.0
The text was updated successfully, but these errors were encountered: