-
Notifications
You must be signed in to change notification settings - Fork 88
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 tests for the deprecations API #1967
Conversation
js-api-spec/deprecations.test.ts
Outdated
}); | ||
|
||
describe('deprecation flags', () => { | ||
it('warning emitted with no flags', done => { |
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.
Nit: test case descriptions should generally form sentence fragments that describe the subject of describe()
(that's why the test function is called it()
—so you can read the whole thing as a sentence). So for example, you might write:
describe('a warning', () => {
it('is emitted with no flags', ...);
it('is emitted with different deprecation type silenced', ...);
// ...
});
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.
Done
Also restructure test names to read as sentences
const extraDeprecations = Object.keys(deprecations).filter( | ||
deprecation => !expectedDeprecations.includes(deprecation) | ||
); | ||
expect(extraDeprecations).toBeEmptyArray(); |
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.
We should check that everything in expectedDeprecations
is in deprecations
as well. Also, we should probably have some sort of test for the deprecation list in the JS API spec 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.
Added an additional check that there are no missing deprecations either.
I also added some types which should ensure that there aren't any extra deprecations in these tests that aren't in the spec.
We now check that there are no missing deprecation types and also use types to ensure that every deprecation in the tests is also in the spec.
See sass/sass#3826
[skip dart-sass]
[skip sass-embedded]