-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Clear and concise description of the problem
I'm porting fetch-mock-jest to a new version for vitest.
In order to create an API that blends jest's mock function assertions and fetch-mock's filtering API I used the following signature:
toHaveLastFetched: ({ fetchMock }: { fetchMock: FetchMock }, filter: CallHistoryFilter, options: RouteConfig): SyncExpectationResult => {Which in turn relies on jest's use of spread parameters:
However vitest does not use spread, forcing me to put all my options in a single object, rather than the previous API design which was far more idiomatic fro fetch-mock users.
Suggested solution
Implement the same API as jest.
I wonder if you are already doing this internally, only the types do not reflect it? (I have some tests which I would expect to fail, as I am passing additional parameters into my RawMatcherFn instances, however the tests pass; it is only the type checking that does not)
Alternative
No response
Additional context
@fetch-mock/vitest codebase https://github.com/wheresrhys/fetch-mock/pull/781/files#diff-9a85644e0fd893bb1f83cfadf2bac0296379d4fb55a14d81d1f6699d0e13364fR34
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.