@storybook/test 8.3.0-alpha.4 → 8.3.0-alpha.6

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -21,8 +21,8 @@ The instrumentation makes sure you can debug those methods in the [addon-interac
21
21
 
22
22
  ```ts
23
23
  // Button.stories.ts
24
+ import { expect, fn, userEvent, within } from '@storybook/test';
24
25
  import { Button } from './Button';
25
- import { within, userEvent, expect, fn } from '@storybook/test';
26
26
 
27
27
  export default {
28
28
  component: Button,
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { AsymmetricMatchersContaining, MatchersObject, MatcherState, JestAssertion, ExpectStatic } from '@vitest/expect';
2
1
  import { TestingLibraryMatchers } from '@testing-library/jest-dom/matchers';
2
+ import { AsymmetricMatchersContaining, MatchersObject, MatcherState, JestAssertion, ExpectStatic } from '@vitest/expect';
3
3
  import * as domTestingLibrary from '@testing-library/dom';
4
4
  import _userEvent from '@testing-library/user-event';
5
- import { spyOn as spyOn$1, fn as fn$1, MaybeMocked, MaybeMockedDeep, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
5
+ import { spyOn as spyOn$1, Mock as Mock$1, MaybeMocked, MaybeMockedDeep, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
6
6
  export * from '@vitest/spy';
7
7
  export { isMockFunction, mocks } from '@vitest/spy';
8
8
 
@@ -113,7 +113,12 @@ declare const userEvent: UserEvent;
113
113
  type Listener = (mock: MockInstance, args: unknown[]) => void;
114
114
  declare function onMockCall(callback: Listener): () => void;
115
115
  declare const spyOn: typeof spyOn$1;
116
- declare const fn: typeof fn$1;
116
+ type Procedure = (...args: any[]) => any;
117
+ type Mock<T extends Procedure | any[] = any[], R = any> = T extends Procedure ? Mock$1<T> : T extends any[] ? Mock$1<(...args: T) => R> : never;
118
+ declare function fn<T extends Procedure = Procedure>(implementation?: T): Mock<T>;
119
+ declare function fn<TArgs extends any[] = any, R = any>(): Mock<(...args: TArgs) => R>;
120
+ declare function fn<TArgs extends any[] = any[], R = any>(implementation: (...args: TArgs) => R): Mock<(...args: TArgs) => R>;
121
+ declare function fn<TArgs extends any[] = any[], R = any>(implementation?: (...args: TArgs) => R): Mock<(...args: TArgs) => R>;
117
122
  /**
118
123
  * Calls [`.mockClear()`](https://vitest.dev/api/mock#mockclear) on every mocked function. This will only empty `.mock` state, it will not reset implementation.
119
124
  *
@@ -171,4 +176,4 @@ declare const expect: Expect;
171
176
 
172
177
  declare const traverseArgs: (value: unknown, depth?: number, key?: string) => unknown;
173
178
 
174
- export { UserEvent, buildQueries, clearAllMocks, configure, createEvent, expect, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, fn, 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, onMockCall, 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, spyOn, traverseArgs, userEvent, waitFor, waitForElementToBeRemoved, within };
179
+ export { Mock, UserEvent, buildQueries, clearAllMocks, configure, createEvent, expect, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, fn, 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, onMockCall, 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, spyOn, traverseArgs, userEvent, waitFor, waitForElementToBeRemoved, within };