-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix: match jest json output by reporting location of error in test file #4826
fix: match jest json output by reporting location of error in test file #4826
Conversation
✅ Deploy Preview for fastidious-cascaron-4ded94 canceled.
|
I don't think we can make this change. It was already reverted in #3645 |
@sheremet-va apologies for not searching previous issues enough. I'm a little perplexed. Consider the following output relating to a test run involving "testResults": [
{
"assertionResults": [
{
"ancestorTitles": [
""
],
"fullName": " addition",
"status": "failed",
"title": "addition",
"duration": 8,
"failureMessages": [
"error thrown in source file"
],
"location": {
"line": 4,
"column": 9
}
}
],
"startTime": 1704030241630,
"endTime": 1704030241638,
"status": "failed",
"message": "",
"name": "/tmp/repro/src/index.test.ts"
}
] There's a line and column number, but no way of telling in which file that line and column are, which makes the Perhaps the actual bug here (if alignment with |
What even is the location in json result? Is it the |
Jest seems to define location as "location of the A stack trace would be great IMHO. Sure, it requires parsing, but it has all the information and none of the ambiguity. If it's an acceptable addition, I'd be happy to look into adding it to the JSON reporter. |
Maybe we should try to actually locate it then? Both the first and the last frames are not the |
I've opened #4843 for the stack trace part (it's minimal). Will close this one. |
Description
This change improves compatibility of the JSON reporter with Jest's
--json
output by pointing to the last stack frame (where the error surfaced in the test) instead of the first.Repro
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.