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(jasmine-this): prevent TS annotations in non-TS files #624

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

puglyfe
Copy link
Contributor

@puglyfe puglyfe commented Oct 8, 2024

Closes #623

This adds an extra check to the jasmine-this transform (which is also used in the mocha transform) to ensure that the source file is actually a TS file rather than just using a TS parser before adding any TS annotations. The tests were previously confirming the existence of this bug, as the filename was hardcoded to test.js, but the test asserted that a TS annotation was added.

To test this, I made a backwards-compatible change to the runPlugin test util to allow setting the source file name.

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.73%. Comparing base (a94e2b5) to head (16c32f9).
Report is 81 commits behind head on main.

Files with missing lines Patch % Lines
src/utils/test-helpers.ts 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #624      +/-   ##
==========================================
+ Coverage   92.38%   92.73%   +0.35%     
==========================================
  Files          26       27       +1     
  Lines        1944     2093     +149     
  Branches      405      443      +38     
==========================================
+ Hits         1796     1941     +145     
- Misses        102      103       +1     
- Partials       46       49       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@skovhus skovhus merged commit a21e985 into skovhus:main Oct 8, 2024
2 of 3 checks passed
@skovhus
Copy link
Owner

skovhus commented Oct 8, 2024

Thanks!

@puglyfe puglyfe deleted the fix-jasmine-this-js-annotation branch October 8, 2024 20:34
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.

bug: TS annotations can be added to non-TS files
2 participants