-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(tests): Fix type errors in tests #4908
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
size-limit report 📦
|
13b8b62
to
b5599ed
Compare
ef459cd
to
355b930
Compare
355b930
to
befc9e3
Compare
@@ -511,10 +511,10 @@ describe('Scope', () => { | |||
contexts: { bar: { id: '3' }, baz: { id: '4' } }, | |||
extra: { bar: '3', baz: '4' }, | |||
fingerprint: ['bar'], | |||
level: 'warning', | |||
level: 'warning' as const, |
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.
why do we need the const
cast? Because of SeverityLevel
? Hmm this might make upgrading more tricky for users then right?
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.
Yeah, I had that same thought. And yet, here are just a few of the many examples of other places in the SDK, both in source code and tests, where this wasn't necessary:
This PR is basically a collection of all of the fixes I've had to make ever since I started work on upgrading jest, and it's been rebased any number of times - the PRs on which it depends had to work their way though to getting merged, and in the meantime things in the repo have been changing rapidly and I've kept having to add new fixes. So it's possible that that was necessary at some stage along the way and now isn't, maybe? Because I don't see how this instance is different from all of the ones above. I'll try again without.
UPDATE: Ah, that's the difference. Drat.
So, it turns out it is necessary, because of the indirection through the localAttributes
variable. If you pass the localAttributes
value directly, rather than assigning it and using the variable, you don't need the as const
. I guess TS implicitly types localAttributes.level
as string
(which, actually, is what it should do), and that's all that carries through to the function. 😕
It's not a blocker for this PR, but probably something we should discuss IRL.
In the process of updating our jest dependencies, a significant number of type errors in tests suddenly appeared. (It seems newer versions of `jest` et al are stricter than the ones we had been using.) This fixes those errors, and changes our jest config so that it will throw an error on any types problems in a test, so we'll know to fix them locally. (Still to do: Fix our configuration so that the linter will catch the errors, so we don't have to actually run the tests to find them.)
In the process of updating our jest dependencies, a significant number of type errors in tests suddenly appeared. (It seems newer versions of `jest` et al are stricter than the ones we had been using.) This fixes those errors, and changes our jest config so that it will throw an error on any types problems in a test, so we'll know to fix them locally. (Still to do: Fix our configuration so that the linter will catch the errors, so we don't have to actually run the tests to find them.)
In the process of updating our jest dependencies, a significant number of type errors in tests suddenly appeared. (It seems newer versions of `jest` et al are stricter than the ones we had been using.) This fixes those errors, and changes our jest config so that it will throw an error on any types problems in a test, so we'll know to fix them locally. (Still to do: Fix our configuration so that the linter will catch the errors, so we don't have to actually run the tests to find them.)
In the process of updating our jest dependencies, a significant number of type errors in tests suddenly appeared. (It seems newer versions of `jest` et al are stricter than the ones we had been using.) This fixes those errors, and changes our jest config so that it will throw an error on any types problems in a test, so we'll know to fix them locally. (Still to do: Fix our configuration so that the linter will catch the errors, so we don't have to actually run the tests to find them.)
In the process of updating our jest dependencies, a significant number of type errors in tests suddenly appeared. (It seems newer versions of
jest
et al are stricter than the ones we had been using.) This fixes those errors, and changes our jest config so that it will throw an error on any types problems in a test, so we'll know to fix them locally. (Still to do: Fix our configuration so that the linter will catch the errors, so we don't have to actually run the tests to find them.)