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.
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.
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.
is that related to why jest.setTimeout doesn't work in circus? #6277
| 'spyOnProperty.test.js', | ||
| ]); | ||
|
|
||
| testFiles.forEach(testFile => { |
|
|
||
| if (globalConfig.errorOnDeprecated) { | ||
| installErrorOnPrivate(environment.global); | ||
| } |
There was a problem hiding this comment.
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.
@thymikee Yeah, I'm planning on a followup to add this behavior to jest-circus as well.
There was a problem hiding this comment.
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.
|
|
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-globalsand 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!