@storybook/test 8.3.0-alpha.5 → 8.3.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +13 -6
- package/dist/index.js +4 -4
- package/dist/index.mjs +5 -4
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TestingLibraryMatchers } from '@testing-library/jest-dom/matchers';
|
|
2
2
|
import { AsymmetricMatchersContaining, MatchersObject, MatcherState, JestAssertion, ExpectStatic } from '@vitest/expect';
|
|
3
3
|
import * as domTestingLibrary from '@testing-library/dom';
|
|
4
|
+
import { BoundFunctions } from '@testing-library/dom';
|
|
4
5
|
import _userEvent from '@testing-library/user-event';
|
|
5
6
|
import { spyOn as spyOn$1, Mock as Mock$1, MaybeMocked, MaybeMockedDeep, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
|
|
6
7
|
export * from '@vitest/spy';
|
|
@@ -120,26 +121,32 @@ declare function fn<TArgs extends any[] = any, R = any>(): Mock<(...args: TArgs)
|
|
|
120
121
|
declare function fn<TArgs extends any[] = any[], R = any>(implementation: (...args: TArgs) => R): Mock<(...args: TArgs) => R>;
|
|
121
122
|
declare function fn<TArgs extends any[] = any[], R = any>(implementation?: (...args: TArgs) => R): Mock<(...args: TArgs) => R>;
|
|
122
123
|
/**
|
|
123
|
-
* Calls [`.mockClear()`](https://vitest.dev/api/mock#mockclear) on every mocked function. This will
|
|
124
|
+
* Calls [`.mockClear()`](https://vitest.dev/api/mock#mockclear) on every mocked function. This will
|
|
125
|
+
* only empty `.mock` state, it will not reset implementation.
|
|
124
126
|
*
|
|
125
127
|
* It is useful if you need to clean up mock between different assertions.
|
|
126
128
|
*/
|
|
127
129
|
declare function clearAllMocks(): void;
|
|
128
130
|
/**
|
|
129
|
-
* Calls [`.mockReset()`](https://vitest.dev/api/mock#mockreset) on every mocked function. This will
|
|
131
|
+
* Calls [`.mockReset()`](https://vitest.dev/api/mock#mockreset) on every mocked function. This will
|
|
132
|
+
* empty `.mock` state, reset "once" implementations and force the base implementation to return
|
|
133
|
+
* `undefined` when invoked.
|
|
130
134
|
*
|
|
131
135
|
* This is useful when you want to completely reset a mock to the default state.
|
|
132
136
|
*/
|
|
133
137
|
declare function resetAllMocks(): void;
|
|
134
138
|
/**
|
|
135
|
-
* Calls [`.mockRestore()`](https://vitest.dev/api/mock#mockrestore) on every mocked function. This
|
|
139
|
+
* Calls [`.mockRestore()`](https://vitest.dev/api/mock#mockrestore) on every mocked function. This
|
|
140
|
+
* will restore all original implementations.
|
|
136
141
|
*/
|
|
137
142
|
declare function restoreAllMocks(): void;
|
|
138
143
|
/**
|
|
139
144
|
* Type helper for TypeScript. Just returns the object that was passed.
|
|
140
145
|
*
|
|
141
|
-
* When `partial` is `true` it will expect a `Partial<T>` as a return value. By default, this will
|
|
142
|
-
* the first level values are mocked. You can pass down `{ deep:
|
|
146
|
+
* When `partial` is `true` it will expect a `Partial<T>` as a return value. By default, this will
|
|
147
|
+
* only make TypeScript believe that the first level values are mocked. You can pass down `{ deep:
|
|
148
|
+
* true }` as a second argument to tell TypeScript that the whole object is mocked, if it actually
|
|
149
|
+
* is.
|
|
143
150
|
*
|
|
144
151
|
* @param item Anything that can be mocked
|
|
145
152
|
* @param deep If the object is deeply mocked
|
|
@@ -165,7 +172,7 @@ declare function mocked<T>(item: T, options: {
|
|
|
165
172
|
}): MaybePartiallyMockedDeep<T>;
|
|
166
173
|
declare function mocked<T>(item: T): MaybeMocked<T>;
|
|
167
174
|
|
|
168
|
-
type Queries =
|
|
175
|
+
type Queries = BoundFunctions<typeof queries>;
|
|
169
176
|
declare module '@storybook/csf' {
|
|
170
177
|
interface Canvas extends Queries {
|
|
171
178
|
}
|