-
-
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
Expose the line number of a failing test block in output #4775
Comments
This sounds like a cool idea. A quick look seems to indicate that this information is not currently available, though. Jasmine would have to expose it. That issue links to a possible workaround overriding @cpojer thoughts? I haven't dug far enough into it to see if it's possible, but based on https://github.com/agirorn/jasmine-slow-reporter it seems like it should be feasible (in the same way we alias |
If it's easy to add and doesn't slow down Jest, I'm on board. |
PR: #4782 |
This comment has been minimized.
This comment has been minimized.
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. |
I'm trying to build an automated reporting tool that flags and skips flaky tests. It would be really helpful if Jest provided the line number for a failing test in the output file.
The script we're using to run generate the output file is:
jest --json --outputFile=./tmp/jest.json --silent .
cc. @gdborton, @ljharb
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
The information in the output file for a failing test includes a stack trace but does not expose the line number of the failing test block.
What is the expected behavior?
Expose the starting line number of the failing test block. So I can append
.skip
toit
blocks.e.g. For this file:
Diff of output with added
lineNumber
:{ "numFailedTestSuites": 1, "numFailedTests": 1, "numPassedTestSuites": 0, "numPassedTests": 0, "numPendingTestSuites": 0, "numPendingTests": 0, "numRuntimeErrorTestSuites": 0, "numTotalTestSuites": 1, "numTotalTests": 1, "snapshot": { "added": 0, "didUpdate": false, "failure": false, "filesAdded": 0, "filesRemoved": 0, "filesUnmatched": 0, "filesUpdated": 0, "matched": 0, "total": 0, "unchecked": 0, "unmatched": 0, "updated": 0 }, "startTime": 1509064905195, "success": false, "testResults": [ { "assertionResults": [ { "ancestorTitles": ["Failing test"], "failureMessages": ["AssertionError: expected false to equal true\n at Object.<anonymous> (/failing_spec.js:5:33)\n at Object.asyncFn (/node_modules/jest-jasmine2/build/jasmine_async.js:68:30)\n at e (/node_modules/jest-jasmine2/build/queue_runner.js:47:12)\n at mapper (/node_modules/jest-jasmine2/build/queue_runner.js:34:19)\n at promise.then (/node_modules/jest-jasmine2/build/queue_runner.js:75:39)\n at process._tickCallback (internal/process/next_tick.js:109:7)"], "fullName": "Failing test should fail", + "lineNumber": [4, 3], "status": "failed", "title": "should fail" }], "endTime": 1509064906822, "message": "\u001b[1m\u001b[31m \u001b[1m● \u001b[1mFailing test › should fail\u001b[39m\u001b[22m\n\n AssertionError: expected false to equal true\n\u001b[2m \u001b[22m\n\u001b[2m \u001b[2mat Object.<anonymous> (\u001b[2m\u001b[0m\u001b[36mspec/javascripts/failing_spec.js\u001b[39m\u001b[0m\u001b[2m:5:33)\u001b[2m\u001b[22m\n\u001b[2m \u001b[2mat process._tickCallback (\u001b[2minternal/process/next_tick.js\u001b[2m:109:7)\u001b[2m\u001b[22m\n", "name": "/spec/javascripts/failing_spec.js", "startTime": 1509064905271, "status": "failed", "summary": "" }], "wasInterrupted": false }
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
The text was updated successfully, but these errors were encountered: