@storybook/test 7.6.0-alpha.6 → 7.6.0-alpha.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +49 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +7 -9
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
import { AsymmetricMatchersContaining, MatchersObject, MatcherState, JestAssertion, ExpectStatic } from '@vitest/expect';
|
2
2
|
import * as matchers from '@testing-library/jest-dom/matchers';
|
3
|
+
import { MaybeMocked, MaybeMockedDeep, MaybePartiallyMocked, MaybePartiallyMockedDeep } from '@vitest/spy';
|
3
4
|
export * from '@vitest/spy';
|
5
|
+
export { fn, isMockFunction, spies as mocks, spyOn } from '@vitest/spy';
|
4
6
|
import * as _testing_library_user_event_dist_types_setup_directApi from '@testing-library/user-event/dist/types/setup/directApi';
|
5
7
|
import * as _testing_library_user_event_dist_types_setup_setup from '@testing-library/user-event/dist/types/setup/setup';
|
6
8
|
import * as domTestingLibrary from '@testing-library/dom';
|
@@ -32,6 +34,52 @@ interface Expect extends AsymmetricMatchersContaining {
|
|
32
34
|
not: AsymmetricMatchersContaining;
|
33
35
|
}
|
34
36
|
|
37
|
+
/**
|
38
|
+
* Calls [`.mockClear()`](https://vitest.dev/api/mock#mockclear) on every mocked function. This will only empty `.mock` state, it will not reset implementation.
|
39
|
+
*
|
40
|
+
* It is useful if you need to clean up mock between different assertions.
|
41
|
+
*/
|
42
|
+
declare function clearAllMocks(): void;
|
43
|
+
/**
|
44
|
+
* Calls [`.mockReset()`](https://vitest.dev/api/mock#mockreset) on every mocked function. This will empty `.mock` state, reset "once" implementations and force the base implementation to return `undefined` when invoked.
|
45
|
+
*
|
46
|
+
* This is useful when you want to completely reset a mock to the default state.
|
47
|
+
*/
|
48
|
+
declare function resetAllMocks(): void;
|
49
|
+
/**
|
50
|
+
* Calls [`.mockRestore()`](https://vitest.dev/api/mock#mockrestore) on every mocked function. This will restore all original implementations.
|
51
|
+
*/
|
52
|
+
declare function restoreAllMocks(): void;
|
53
|
+
/**
|
54
|
+
* Type helper for TypeScript. Just returns the object that was passed.
|
55
|
+
*
|
56
|
+
* When `partial` is `true` it will expect a `Partial<T>` as a return value. By default, this will only make TypeScript believe that
|
57
|
+
* the first level values are mocked. You can pass down `{ deep: true }` as a second argument to tell TypeScript that the whole object is mocked, if it actually is.
|
58
|
+
*
|
59
|
+
* @param item Anything that can be mocked
|
60
|
+
* @param deep If the object is deeply mocked
|
61
|
+
* @param options If the object is partially or deeply mocked
|
62
|
+
*/
|
63
|
+
declare function mocked<T>(item: T, deep?: false): MaybeMocked<T>;
|
64
|
+
declare function mocked<T>(item: T, deep: true): MaybeMockedDeep<T>;
|
65
|
+
declare function mocked<T>(item: T, options: {
|
66
|
+
partial?: false;
|
67
|
+
deep?: false;
|
68
|
+
}): MaybeMocked<T>;
|
69
|
+
declare function mocked<T>(item: T, options: {
|
70
|
+
partial?: false;
|
71
|
+
deep: true;
|
72
|
+
}): MaybeMockedDeep<T>;
|
73
|
+
declare function mocked<T>(item: T, options: {
|
74
|
+
partial: true;
|
75
|
+
deep?: false;
|
76
|
+
}): MaybePartiallyMocked<T>;
|
77
|
+
declare function mocked<T>(item: T, options: {
|
78
|
+
partial: true;
|
79
|
+
deep: true;
|
80
|
+
}): MaybePartiallyMockedDeep<T>;
|
81
|
+
declare function mocked<T>(item: T): MaybeMocked<T>;
|
82
|
+
|
35
83
|
declare const buildQueries: typeof domTestingLibrary.buildQueries;
|
36
84
|
declare const configure: typeof domTestingLibrary.configure;
|
37
85
|
declare const createEvent: domTestingLibrary.CreateObject & domTestingLibrary.CreateFunction;
|
@@ -126,4 +174,4 @@ declare const userEvent: {
|
|
126
174
|
|
127
175
|
declare const expect: Expect;
|
128
176
|
|
129
|
-
export { buildQueries, configure, createEvent, expect, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, getAllByAltText, getAllByDisplayValue, getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllByTestId, getAllByText, getAllByTitle, getByAltText, getByDisplayValue, getByLabelText, getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, getConfig, getDefaultNormalizer, getElementError, getNodeText, getQueriesForElement, getRoles, getSuggestedQuery, isInaccessible, logDOM, logRoles, prettyDOM, prettyFormat, queries, queryAllByAltText, queryAllByAttribute, queryAllByDisplayValue, queryAllByLabelText, queryAllByPlaceholderText, queryAllByRole, queryAllByTestId, queryAllByText, queryAllByTitle, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryByTestId, queryByText, queryByTitle, queryHelpers, screen, userEvent, waitFor, waitForElementToBeRemoved, within };
|
177
|
+
export { buildQueries, clearAllMocks, configure, createEvent, expect, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, getAllByAltText, getAllByDisplayValue, getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllByTestId, getAllByText, getAllByTitle, getByAltText, getByDisplayValue, getByLabelText, getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, getConfig, getDefaultNormalizer, getElementError, getNodeText, getQueriesForElement, getRoles, getSuggestedQuery, isInaccessible, logDOM, logRoles, mocked, prettyDOM, prettyFormat, queries, queryAllByAltText, queryAllByAttribute, queryAllByDisplayValue, queryAllByLabelText, queryAllByPlaceholderText, queryAllByRole, queryAllByTestId, queryAllByText, queryAllByTitle, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryByTestId, queryByText, queryByTitle, queryHelpers, resetAllMocks, restoreAllMocks, screen, userEvent, waitFor, waitForElementToBeRemoved, within };
|