-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Run all tests with all deprecations enabled, and with them at the default state for the version #20668
Merged
Merged
Run all tests with all deprecations enabled, and with them at the default state for the version #20668
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import type { DeprecationOptions } from '@ember/debug/lib/deprecate'; | ||
import { ENV } from '@ember/-internals/environment'; | ||
|
||
function isEnabled(options: DeprecationOptions) { | ||
return Object.hasOwnProperty.call(options.since, 'enabled') || ENV._ALL_DEPRECATIONS_ENABLED; | ||
} | ||
|
||
function deprecation(options: DeprecationOptions) { | ||
return { | ||
options, | ||
test: !isEnabled(options), | ||
isEnabled: isEnabled(options), | ||
}; | ||
} | ||
|
||
/* | ||
To add a deprecation, you must add a new entry to the `DEPRECATIONS` object. | ||
The entry should be an object with the following properties: | ||
|
||
* `id` (required): A string that uniquely identifies the deprecation. This | ||
should be a short, descriptive name, typically dasherized. | ||
* `for` (required): The string `ember-source` -- every deprecation from this | ||
package is for `ember-source`. | ||
* `since` (required): An object with `available` and `enabled`. `available` is | ||
the first version of Ember that the deprecation is available in. `enabled` is | ||
the version of Ember that the deprecation was first enabled. This is used as | ||
a feature flag deprecations. For public APIs, the `enabled` value is added | ||
only once the deprecation RFC is [Ready for Release](https://github.com/emberjs/rfcs#ready-for-release). | ||
* `until` (required): The version of Ember that the deprecation will be removed | ||
* `url` (required): A URL to the deprecation guide for the deprecation. This | ||
URL can be constructed in advance of the deprecation being added to the | ||
[deprecation app](https://github.com/ember-learn/deprecation-app) by | ||
following this format: `https://deprecations.emberjs.com/deprecations/{{id}}`. | ||
|
||
For example: | ||
`deprecate` should then be called using the entry from the `DEPRECATIONS` object. | ||
|
||
```ts | ||
import { DEPRECATIONS } from '@ember/-internals/deprecations'; | ||
//... | ||
|
||
deprecate(message, DEPRECATIONS.MY_DEPRECATION.test, DEPRECATIONS.MY_DEPRECATION.options); | ||
``` | ||
|
||
`expectDeprecation` should also use the DEPRECATIONS object, but it should be noted | ||
that it uses `isEnabled` instead of `test` because the expectations of `expectDeprecation` | ||
are the opposite of `test`. | ||
|
||
```ts | ||
expectDeprecation( | ||
() => { | ||
assert.equal(foo, bar(), 'foo is equal to bar'); // something that triggers the deprecation | ||
}, | ||
/matchesMessage/, | ||
DEPRECATIONS.MY_DEPRECATION.isEnabled | ||
); | ||
``` | ||
*/ | ||
export const DEPRECATIONS = { | ||
DEPRECATE_IMPLICIT_ROUTE_MODEL: deprecation({ | ||
id: 'deprecate-implicit-route-model', | ||
for: 'ember-source', | ||
since: { available: '5.3.0', enabled: '5.3.0' }, | ||
until: '6.0.0', | ||
url: 'https://deprecations.emberjs.com/v5.x/#toc_deprecate-implicit-route-model', | ||
}), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 might be tricky when it comes to me generating the list of things to deprecate for 'ember' -- maybe I'll codemod it.
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.
Can you elaborate?
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.
It should be the same list you needed to generate previously, but now will all be referenced from one location. The message can still vary by location used (and is expected to do so).