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

feat: support multiple TypeScript versions #123

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JoshuaKGoldberg
Copy link
Owner

PR Checklist

Overview

Adds in an optional versions option to the expect rule. It allows passing in an array of objects with a required name and path properties.

src/rules/expect.ts Outdated Show resolved Hide resolved
Copy link

codecov bot commented Dec 21, 2023

Codecov Report

Attention: 321 lines in your changes are missing coverage. Please review.

Comparison is base (5dfdd92) 81.79% compared to head (9938a47) 67.31%.
Report is 2 commits behind head on main.

Files Patch % Lines
src/assertions/types.ts 0.00% 76 Missing ⚠️
src/utils/versions.ts 40.40% 59 Missing ⚠️
src/utils/typescript.ts 46.72% 57 Missing ⚠️
src/utils/programs.ts 28.20% 56 Missing ⚠️
src/failures/types.ts 0.00% 21 Missing ⚠️
src/utils/files.ts 12.50% 21 Missing ⚠️
src/rules/expect.ts 88.13% 14 Missing ⚠️
src/assertions/parseAssertions.ts 90.44% 13 Missing ⚠️
src/failures/getExpectTypeFailures.ts 97.14% 3 Missing ⚠️
src/rules/sandbox/file.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #123       +/-   ##
===========================================
- Coverage   81.79%   67.31%   -14.49%     
===========================================
  Files          10       21       +11     
  Lines         835     1184      +349     
  Branches       93       88        -5     
===========================================
+ Hits          683      797      +114     
- Misses        152      387      +235     

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

}

const host = ts.createCompilerHost(parsed.options, true);
return ts.createProgram(parsed.fileNames, parsed.options, host);
Copy link
Owner Author

Choose a reason for hiding this comment

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

I couldn't figure out how to get the programs created by this to read from the files set up by the rule tester. https://github.com/JoshuaKGoldberg/eslint-plugin-expect-type/actions/runs/7283460649/job/19847369501 > #123 (comment):

Right now in tests this is logging:

sourceFile.getText() // (stub file for RuleTester programs)

🤔 I couldn't figure out how to get the program to read from virtual memory. Grr.

For now the versions option isn't unit tested... Not great.

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.

🚀 Feature: Allow specifying multiple TS versions (node_modules/typescript paths)
1 participant