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

Fix when properties in test name #301

Merged
merged 1 commit into from
Jul 18, 2023
Merged

Conversation

Gkleinereva
Copy link
Contributor

@Gkleinereva Gkleinereva commented Mar 11, 2023

Fixes #299

Full disclosure: I've never worked on this, or any, VS Code extension before. I'm also not a pro at the jest command line. No worries if this needs more work!

There are still a few weird edge cases that I'm not sure how to get around. It seems to me that the core of the problem is that VSCode passes a string to the extension handlers, regardless of whether or not a string (as opposed to a symbol) is used in the test name.

For example, the following test will not be captured by the CodeLens option in the extension after my change:

it('has.name randomly in it', () => {...});

or maybe a bit more realistically, this one would not be captured either:

it('The method MyClass.prototype.myMethod exists', () => {...});

On the whole, I still think this is a considerable improvement from current functionality, and will allow me to use the extension in work projects where I currently can't. :)

@firsttris
Copy link
Owner

Hey @Gkleinereva,

thx for your contribution. i will do some testing and get back to you.

dont worry im also a junior in vscode extensions.

@Gkleinereva
Copy link
Contributor Author

Hey @firsttris I know you probably have a lot of other stuff to do, but do you have some idea of when this might be reviewed and/or merged? Thanks :)

@Gkleinereva
Copy link
Contributor Author

Hey @firsttris any thoughts on getting this merged?

@firsttris
Copy link
Owner

its on my list of stuff i need to get done.

i also need to setup a new vsce token to publish a new version.

hopefully i can squeeze it in this week.

@Gkleinereva
Copy link
Contributor Author

Thanks for the update :)

@firsttris
Copy link
Owner

i made some tests and could verify that using properties in tests names is now possible. you did it. great work.

@firsttris firsttris merged commit 6d2697e into firsttris:master Jul 18, 2023
@Gkleinereva
Copy link
Contributor Author

Woohoo! Thanks for reviewing/merging @firsttris!

@firsttris
Copy link
Owner

since this change "Run Jest" does no longer run the whole file if you right click and choose "Run Jest" outside an it().

it seems like a bit of an edge case, but do you think its possible to restore this functionality ?

@domsleee
Copy link
Collaborator

It looks like a simple fix, receivedTestName can be undefined if you click outside the file
6d2697e#diff-3294a832ea2276e554177e0b3007cc2d401c082912c7fbde49fa09141bf1aed1R104

@Gkleinereva
Copy link
Contributor Author

@firsttris thanks for letting me know - it'll take me a little while to figure out the development environment again, but I should be able to submit a PR tomorrow or Friday.

@domsleee thanks for the tip!

@firsttris
Copy link
Owner

hey @Gkleinereva dont worry.
@domsleee already provided a fix #325

its already in the latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debug Test skips tests using class name / prototype name as test name
3 participants