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

Use fullName in TestResult #632

Merged
merged 3 commits into from
Nov 8, 2020

Conversation

connectdotz
Copy link
Collaborator

@connectdotz connectdotz commented Oct 25, 2020

Motivation

The TestResult.name was from the source block, which has led to a few problems during debugging as we used the name as the --testNamePattern:

  1. it only has lexical string, i.e. no runtime translation like template-literal, therefore not able to debug with --testNamePattern.
    • we should used the info from assertions, not source block
  2. it doesn't have the hierarchical context, i.e. describe blocks, so if the file has multiple tests with the same name under different describe blocks, they will all be executed
    • solution: use assertions.fullName resolved this, now the debug can be precise

Implementation

  • This PR mainly modified the logic of how we extract TestResult.name.
    • Optionally, capture all the relevant names in a new property names in case it is needed in the future.
  • upgrade jest

Notes

  • added some test with test.each so we can make sure it worked for us and our users. However, these tests will need the new jest to work properly in vscode, so you will need to build the extension with this PR in order to test in vscode.

fixes #627
fixes #620 (particularly this comment)

@connectdotz
Copy link
Collaborator Author

ping @seanpoulter @stephtr hey, will any of you have some cycle to review this PR?

@connectdotz
Copy link
Collaborator Author

@seanpoulter @stephtr, looks like you guys are swapped, then what do you guys think we could do? Just merge in or you have other suggestions?

@connectdotz
Copy link
Collaborator Author

hmmm... I didn't hear anything from anybody, hopefully, everybody is doing all right and just busy... In the spirit of helping our users, let's merge it in alpha so we can fix and release v4 soon.

@connectdotz connectdotz merged commit 277b9be into jest-community:master Nov 8, 2020
@connectdotz connectdotz deleted the fix-debug-test-name branch November 8, 2020 16:23
legend1202 pushed a commit to legend1202/vscode-jest that referenced this pull request Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant