-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Add a "errorOnDeprecated" mode that errors when calling deprecated APIs #6339
Conversation
… jasmine features. This lays the groundwork for adding other helpful errors for deprecated features/APIs.
12 | }); | ||
13 | | ||
|
||
at packages/jest-jasmine2/build/error_on_private.js:69:11 |
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.
I thought I had trimmed this. I'll see if it's possible.
Nice! I wonder if we should also find other tings we want to deprecate, and add them as well? EDIT: Reading, how even?
|
throwAtFunction( | ||
'Illegal usage of `jasmine.DEFAULT_TIMEOUT_INTERVAL`, prefer `jest.setTimeout`.', | ||
jasmine.set, | ||
); |
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.
Whoops. Jest actually sets this under the hood, so I'll have to find a different way to do this.
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.
is that related to why jest.setTimeout
doesn't work in circus? #6277
'spyOnProperty.test.js', | ||
]); | ||
|
||
testFiles.forEach(testFile => { |
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.
test.each
maybe?
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.
@@ -100,6 +101,10 @@ async function jasmine2( | |||
expand: globalConfig.expand, | |||
}); | |||
|
|||
if (globalConfig.errorOnDeprecated) { | |||
installErrorOnPrivate(environment.global); | |||
} |
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.
I wonder if we should move this outside of jest jasmine. If user changes runner to circus, then depreciation errors will be gone, and only cryptic errors like "cannot call function on undefined" will surface
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.
@thymikee Yeah, I'm planning on a followup to add this behavior to jest-circus as well.
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.
Any idea where this could live that it would be shared by both?
@SimenB I'm not sure I understand the question. Are you asking "How does this lay the groundwork?". |
Nah, It was mostly a response to my inability to read the OP properly - that it laid the groundwork for other deprecations |
Codecov Report
@@ Coverage Diff @@
## master #6339 +/- ##
==========================================
+ Coverage 63.63% 63.79% +0.16%
==========================================
Files 226 229 +3
Lines 8648 8717 +69
Branches 4 4
==========================================
+ Hits 5503 5561 +58
- Misses 3144 3155 +11
Partials 1 1
Continue to review full report at Codecov.
|
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.
LGTM
Okay, I've removed the |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
These helpful errors, in concert with
no-jasmine-globals
and possible code mods (@aaronabramov) will help the community to upgrade to jest-circus in the next major release.This also lays the groundwork for adding other helpful errors for deprecated features/APIs.
@SimenB I stole these from your eslint rule. Thanks!