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

Include fullName in formattedAssertion #4273

Merged
merged 1 commit into from
Aug 15, 2017

Conversation

aifreedom
Copy link
Contributor

Summary
Reinstate of #3378 with added tests.

This PR adds an additional field fullName to FormattedAssertionResult.

When we try to analyze the test result json, we find that two it test cases under different describe block in one test file are rendered the same in the json report. Including the full name help solving this issue.

Test plan

  • Unit test
  • Manual test output
...
    "testResults": [
        {
            "assertionResults": [
                {
                    "failureMessages": [],
                    "fullName": "Header renders",
                    "status": "passed",
                    "title": "renders"
                },
                {
                    "failureMessages": [],
                    "fullName": "Header renders <Element /> with right props",
                    "status": "passed",
                    "title": "renders <Element /> with right props"
                }
            ],
            "endTime": 1493233733071,
            "message": "",
            "name": "/path/to/the/test/file.js",
            "startTime": 1493233730480,
            "status": "passed",
            "summary": ""
        }
    ],
...


'use strict';

const formatTestResults = require('../formatTestResults');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be using underscores to match packages/jest-util/src/format_test_results.js?

Copy link
Contributor Author

@aifreedom aifreedom Aug 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The source file's name is formatTestResults.js while lint asks me to snake_case the test file. Not sure what's the right way to unify them..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can rename that file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, what? The source file on latest master is format_test_results.js, so I'm not sure if I understand that comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I didn't notice that after I rebase. If that's the case, how come the require worked??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, because this was called _test but we only look for .test files, so this wasn't actually run. I'll fix it.

@cpojer
Copy link
Member

cpojer commented Aug 15, 2017

I'll figure out what's wrong with the tests and the require name.

@cpojer cpojer merged commit 631ff09 into jestjs:master Aug 15, 2017
@cpojer
Copy link
Member

cpojer commented Aug 15, 2017

Thank you for following up on this and sending a PR. I apologize for closing the initial PR. I think I was pretty stressed out then and didn't have a lot of time reviewing this properly :)

@aifreedom aifreedom deleted the include-fullName branch August 15, 2017 18:34
tushardhole pushed a commit to tushardhole/jest that referenced this pull request Aug 21, 2017
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants