-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Breaking changes to the test() interface #2785
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
Merged
Merged
Conversation
This file contains hidden or 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 affects test() and t.try(). Supporting multiple implementations made both the implementation and the type definitions needlessly complex. Using for/of syntax it's easy enough to declare tests (or t.try() attempts) with the same arguments.
It should result in an error.
Fixes #2189. `test.macro()` returns an object that can be used with `test()` and hooks. The `t.context` type is inherited from `test`. Like with AVA 3, regular functions that also have a `title` property that is a string-returning function are supported. However this is no longer in the type definition. Instead the recommended approach is to use `test.macro()` to declare macros. At a TypeScript level these are easier to discriminate from regular implementations.
This mostly impacts macros, for which we'd want to encourage explicit types.
Fixes #2253 which no longer seems reproducible.
* Split across multiple files. * Rename types, most noticeably `TestInterface` is now `TestFn`, but really anything that had the Interface suffix has been changed. * Update some documentation.
Note that |
This was referenced Jul 5, 2021
Make the behavior explicit in the documentation and type definition.
The implemenation already fails the assertion when null is provided.
Re d546fe0, why Context: sindresorhus/meta#7 |
Because I like |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2716.
Remove support for passing multiple test implementations. This affects test() and t.try().
Supporting multiple implementations made both the implementation and the type definitions needlessly complex. Using for/of syntax it's easy enough to declare tests (or t.try() attempts) with the same arguments.
Change constructor type for
instanceOf
expectation. It should result in anError
subclass.Add
test.macro()
, change how macros are typed. Fixes #2189.test.macro()
returns an object that can be used withtest()
and hooks. Thet.context
type is inherited fromtest
.Like with AVA 3, regular functions that also have a
title
property that is a string-returning function are supported. However this is no longer in the type definition.Instead the recommended approach is to use
test.macro()
to declare macros. At a TypeScript level these are easier to discriminate from regular implementations.Change implementation argument type constraint to unknown. This mostly impacts macros, for which we'd want to encourage explicit types.
Add test for context covariance. Fixes #2253 which no longer seems reproducible.
Add test for implementation result types.
Refactor type definition. Split across multiple files. Rename types, most noticeably
TestInterface
is nowTestFn
, but really anything that had the Interface suffix has been changed. Update some documentation.Return null when throws() and throwsAsync() assertions fail.
Update type definitions to disallow null throws expectations.