-
Notifications
You must be signed in to change notification settings - Fork 4
fix(test-utils): Support re-export declarations #84
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
Conversation
| }); | ||
|
|
||
| test('throws error on unknown export', () => { | ||
| expect(() => buildTestUtilsProject('errors-no-wrapper-classes')).toThrow( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixture existed, but was never used 🤦
| return declarations[0]; | ||
| } | ||
|
|
||
| export function printFlags(flags: number, mapping: Record<number, string>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used in the final version of the code, but it was useful in local debugging to convert binary flags into readable strings
Let's keep it in the code so I will not have to remember how it is done every time
| throw new Error(`Exported symbol is not a class, got ${checker.symbolToString(symbol)}`); | ||
| } | ||
|
|
||
| const classType = checker.getTypeAtLocation(extractDeclaration(symbol)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual fix. Replace getTypeAtLocation with getDeclaredTypeOfSymbol to make typescript actually go cross-files to find the real type
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #84 +/- ##
==========================================
+ Coverage 92.05% 92.21% +0.15%
==========================================
Files 15 15
Lines 919 925 +6
Branches 274 272 -2
==========================================
+ Hits 846 853 +7
+ Misses 73 72 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1b9762d to
7b3ec3c
Compare
7b3ec3c to
5fc0ed7
Compare
Issue #, if available:
Description of changes:
Follow up for #77
The new version does not support the most important use-case, re-exporting the classes:
Fixed now and added a unit test
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.