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: support path based auto completion for jsx and tsx #977

Merged
merged 2 commits into from
Jan 8, 2023
Merged

fix: support path based auto completion for jsx and tsx #977

merged 2 commits into from
Jan 8, 2023

Conversation

mrazauskas
Copy link
Contributor

Following up #963

Thanks for path based auto completion for jest.mock and similar methods. Very helpful.

It works perfect in js and ts files. I just noticed that the feature is missing if a test file has jsx or tsx extension. Adding javascriptreact and typescriptreact language selectors fixed this issue locally.

@coveralls
Copy link

coveralls commented Dec 27, 2022

Pull Request Test Coverage Report for Build 3789219179

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 97.439%

Totals Coverage Status
Change from base Build 3737121544: 0.0%
Covered Lines: 3312
Relevant Lines: 3346

💛 - Coveralls

Copy link
Collaborator

@connectdotz connectdotz left a comment

Choose a reason for hiding this comment

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

Great catch, thanks for the PR!

@connectdotz connectdotz merged commit 77b2448 into jest-community:master Jan 8, 2023
@mrazauskas mrazauskas deleted the fix-support-path-based-auto-completion-for-jsx-and-tsx branch January 8, 2023 16:56
@mrazauskas
Copy link
Contributor Author

Thanks for taking a look.

By the way, is there any reason why jest.unstable_mockModule() is excluded from the list of APIs with path autocompletion?

I use Jest and vscode-jest in one medium sized ESM project. unstable_mockModule() is the only way to create mocks in that case, so it would be nice to have autocompletion. If unstable_mockModule() wasn’t included simply by mistake, I can send a PR.

@connectdotz
Copy link
Collaborator

Is this an official API yet? I don't see it in the API doc, but it did appear in https://jestjs.io/docs/ecmascript-modules#module-mocking-in-esm ... do you know what the state of this API is?

If it is going to stay, then I guess it's ok to add it to our support list. PR is welcome.

legend1202 pushed a commit to legend1202/vscode-jest that referenced this pull request Jun 18, 2023
…munity#977)

* fix: support path based auto completion for jsx and tsx

* fix typo
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.

3 participants