mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-02 05:03:44 +08:00
Rename @storybook/test to storybook/test
This commit is contained in:
parent
7ae3d68b70
commit
d3087816c0
@ -1,7 +1,8 @@
|
||||
import { beforeAll, vi, expect as vitestExpect } from 'vitest';
|
||||
|
||||
import { setProjectAnnotations } from '@storybook/react';
|
||||
import { userEvent as storybookEvent, expect as storybookExpect } from '@storybook/test';
|
||||
|
||||
import { userEvent as storybookEvent, expect as storybookExpect } from 'storybook/test';
|
||||
|
||||
import preview from './preview';
|
||||
|
||||
|
@ -4,9 +4,9 @@ import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
import { ThemeProvider, convert, themes } from 'storybook/internal/theming';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import type axe from 'axe-core';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { A11YPanel } from './A11YPanel';
|
||||
import { A11yContext } from './A11yContext';
|
||||
|
@ -3,7 +3,7 @@ import React from 'react';
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { TestDiscrepancyMessage } from './TestDiscrepancyMessage';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { AfterEach } from 'storybook/internal/types';
|
||||
|
||||
import { expect } from '@storybook/test';
|
||||
import { expect } from 'storybook/test';
|
||||
|
||||
import { run } from './a11yRunner';
|
||||
import type { A11yParameters } from './params';
|
||||
|
@ -2,7 +2,8 @@
|
||||
import type { LoaderFunction } from 'storybook/internal/types';
|
||||
|
||||
import { global } from '@storybook/global';
|
||||
import type { onMockCall as onMockCallType } from '@storybook/test';
|
||||
|
||||
import type { onMockCall as onMockCallType } from 'storybook/test';
|
||||
|
||||
import { action } from './runtime';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { spyOn } from '@storybook/test';
|
||||
import { spyOn } from 'storybook/test';
|
||||
|
||||
const meta = {
|
||||
component: globalThis.Components.Button,
|
||||
|
@ -1,10 +1,11 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, fireEvent, fn, userEvent, within } from '@storybook/test';
|
||||
|
||||
import { action } from '@storybook/addon-actions';
|
||||
|
||||
import { expect, fireEvent, fn, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { SaveStory } from './SaveStory';
|
||||
|
||||
const meta = {
|
||||
|
@ -2,7 +2,7 @@ import * as ReactExport from 'react';
|
||||
import * as ReactDom from 'react-dom';
|
||||
import * as ReactDomServer from 'react-dom/server';
|
||||
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
/**
|
||||
* This component is used to display the resolved version of React and its related packages. As long
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Button,
|
||||
|
@ -9,7 +9,7 @@ Storybook Addon Interactions enables visual debugging of interactions and tests
|
||||
Install this addon by adding the `@storybook/addon-interactions` dependency:
|
||||
|
||||
```sh
|
||||
yarn add -D @storybook/addon-interactions @storybook/test
|
||||
yarn add -D @storybook/addon-interactions
|
||||
```
|
||||
|
||||
within `.storybook/main.js`:
|
||||
@ -24,10 +24,10 @@ Note that `@storybook/addon-interactions` must be listed **after** `@storybook/a
|
||||
|
||||
## Usage
|
||||
|
||||
Interactions relies on "instrumented" versions of Vitest and Testing Library, that you import from `@storybook/test` instead of their original package. You can then use these libraries in your `play` function.
|
||||
Interactions relies on "instrumented" versions of Vitest and Testing Library, that you import from `storybook/test` instead of their original package. You can then use these libraries in your `play` function.
|
||||
|
||||
```js
|
||||
import { expect, fn, userEvent, within } from '@storybook/test';
|
||||
import { expect, fn, userEvent, within } from 'storybook/test';
|
||||
import { Button } from './Button';
|
||||
|
||||
export default {
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { CallStates } from 'storybook/internal/instrumenter';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, userEvent, within } from '@storybook/test';
|
||||
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { getCalls } from '../mocks';
|
||||
import { Interaction } from './Interaction';
|
||||
|
@ -4,7 +4,8 @@ import { CallStates } from 'storybook/internal/instrumenter';
|
||||
import { styled } from 'storybook/internal/theming';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, userEvent, waitFor, within } from '@storybook/test';
|
||||
|
||||
import { expect, userEvent, waitFor, within } from 'storybook/test';
|
||||
|
||||
import { isChromatic } from '../../../../.storybook/isChromatic';
|
||||
import { getCalls, getInteractions } from '../mocks';
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
|
||||
import {
|
||||
expect,
|
||||
fireEvent,
|
||||
@ -7,7 +8,7 @@ import {
|
||||
waitFor,
|
||||
waitForElementToBeRemoved,
|
||||
within,
|
||||
} from '@storybook/test';
|
||||
} from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Form,
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { userEvent, within } from '@storybook/test';
|
||||
|
||||
import { userEvent, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Button,
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, waitFor, within } from '@storybook/test';
|
||||
|
||||
import { expect, waitFor, within } from 'storybook/test';
|
||||
|
||||
import { HighlightElement } from './HighlightElement';
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, userEvent, waitFor, within } from '@storybook/test';
|
||||
|
||||
import { expect, userEvent, waitFor, within } from 'storybook/test';
|
||||
|
||||
import { List } from './List';
|
||||
import { ListItem } from './ListItem/ListItem';
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { GuidedTour } from './GuidedTour';
|
||||
|
||||
|
@ -3,8 +3,8 @@ import React, { useState } from 'react';
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, fn, userEvent, within } from '@storybook/test';
|
||||
|
||||
import { expect, fn, userEvent, within } from 'storybook/test';
|
||||
import dedent from 'ts-dedent';
|
||||
|
||||
import { GlobalErrorContext, GlobalErrorModal } from './GlobalErrorModal';
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { CallStates } from 'storybook/internal/instrumenter';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, userEvent, within } from '@storybook/test';
|
||||
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { getCalls } from '../mocks';
|
||||
import { Interaction } from './Interaction';
|
||||
|
@ -5,7 +5,8 @@ import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
import { styled } from 'storybook/internal/theming';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, fn, userEvent, waitFor, within } from '@storybook/test';
|
||||
|
||||
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
|
||||
|
||||
import { isChromatic } from '../../../../.storybook/isChromatic';
|
||||
import { getCalls, getInteractions } from '../mocks';
|
||||
|
@ -4,7 +4,8 @@ import { CallStates } from 'storybook/internal/instrumenter';
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { TestDiscrepancyMessage } from './TestDiscrepancyMessage';
|
||||
|
||||
|
@ -6,7 +6,8 @@ import { styled } from 'storybook/internal/theming';
|
||||
import { Addon_TypesEnum } from 'storybook/internal/types';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, fn } from '@storybook/test';
|
||||
|
||||
import { expect, fn } from 'storybook/test';
|
||||
|
||||
import { type Details, storeOptions } from '../constants';
|
||||
import { store as mockStore } from '../manager-store.mock';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { experimental_MockUniversalStore } from 'storybook/internal/manager-api';
|
||||
|
||||
import * as testUtils from '@storybook/test';
|
||||
import * as testUtils from 'storybook/test';
|
||||
|
||||
import { storeOptions } from './constants';
|
||||
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
waitFor,
|
||||
waitForElementToBeRemoved,
|
||||
within,
|
||||
} from '@storybook/test';
|
||||
} from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Form,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { userEvent, within } from '@storybook/test';
|
||||
import { userEvent, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Button,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect } from '@storybook/test';
|
||||
import { expect } from 'storybook/test';
|
||||
|
||||
import { MINIMAL_VIEWPORTS } from '@storybook/addon-viewport';
|
||||
|
||||
|
@ -181,6 +181,10 @@
|
||||
"import": "./dist/instrumenter/index.js",
|
||||
"require": "./dist/instrumenter/index.cjs"
|
||||
},
|
||||
"./test": {
|
||||
"types": "./dist/test/index.d.ts",
|
||||
"import": "./dist/test/index.js"
|
||||
},
|
||||
"./internal/preview/runtime": {
|
||||
"import": "./dist/preview/runtime.js"
|
||||
},
|
||||
|
@ -50,7 +50,6 @@ export default {
|
||||
'@storybook/csf-plugin': '9.0.0-alpha.1',
|
||||
'@storybook/react-dom-shim': '9.0.0-alpha.1',
|
||||
'@storybook/source-loader': '9.0.0-alpha.1',
|
||||
'@storybook/test': '9.0.0-alpha.1',
|
||||
'@storybook/preset-create-react-app': '9.0.0-alpha.1',
|
||||
'@storybook/preset-html-webpack': '9.0.0-alpha.1',
|
||||
'@storybook/preset-preact-webpack': '9.0.0-alpha.1',
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, userEvent, within } from '@storybook/test';
|
||||
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { Button } from '../Button/Button';
|
||||
import { Modal } from './Modal';
|
||||
|
@ -2,11 +2,12 @@ import React from 'react';
|
||||
|
||||
import { BottomBarIcon, CloseIcon } from '@storybook/icons';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect } from '@storybook/test';
|
||||
import { findByText, fireEvent, screen, userEvent, waitFor, within } from '@storybook/test';
|
||||
|
||||
import { action } from '@storybook/addon-actions';
|
||||
|
||||
import { expect } from 'storybook/test';
|
||||
import { findByText, fireEvent, screen, userEvent, waitFor, within } from 'storybook/test';
|
||||
|
||||
import { IconButton } from '../IconButton/IconButton';
|
||||
import { TabWrapper, Tabs, TabsState } from './tabs';
|
||||
import type { ChildrenList } from './tabs.helpers';
|
||||
|
@ -4,7 +4,8 @@ import React from 'react';
|
||||
import { styled } from 'storybook/internal/theming';
|
||||
|
||||
import type { StoryObj } from '@storybook/react';
|
||||
import { expect, screen } from '@storybook/test';
|
||||
|
||||
import { expect, screen } from 'storybook/test';
|
||||
|
||||
import { TooltipMessage } from './TooltipMessage';
|
||||
import { WithToolTipState as WithTooltip } from './WithTooltip';
|
||||
|
@ -5,10 +5,11 @@ import { LocationProvider } from 'storybook/internal/router';
|
||||
import { styled } from 'storybook/internal/theming';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import { action } from '@storybook/addon-actions';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import MobileNavigationStoriesMeta from '../mobile/navigation/MobileNavigation.stories';
|
||||
import { Layout } from './Layout';
|
||||
import { LayoutProvider } from './LayoutProvider';
|
||||
|
@ -3,7 +3,8 @@ import React, { useEffect } from 'react';
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { within } from '@storybook/test';
|
||||
|
||||
import { within } from 'storybook/test';
|
||||
|
||||
import { LayoutProvider, useLayout } from '../../layout/LayoutProvider';
|
||||
import { MobileAbout } from './MobileAbout';
|
||||
|
@ -3,9 +3,9 @@ import React from 'react';
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { within } from '@storybook/test';
|
||||
|
||||
import { startCase } from 'es-toolkit';
|
||||
import { within } from 'storybook/test';
|
||||
|
||||
import { LayoutProvider, useLayout } from '../../layout/LayoutProvider';
|
||||
import { MobileNavigation } from './MobileNavigation';
|
||||
|
@ -8,10 +8,11 @@ import {
|
||||
FaceHappyIcon,
|
||||
} from '@storybook/icons';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, fn, userEvent, waitFor, within } from '@storybook/test';
|
||||
|
||||
import { action } from '@storybook/addon-actions';
|
||||
|
||||
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
|
||||
|
||||
import NotificationItem from './NotificationItem';
|
||||
|
||||
const meta = {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, findByText, fireEvent, fn } from '@storybook/test';
|
||||
|
||||
import { expect, findByText, fireEvent, fn } from 'storybook/test';
|
||||
|
||||
import { FileSearchList } from './FileSearchList';
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, findByText, fireEvent, fn } from '@storybook/test';
|
||||
|
||||
import { expect, findByText, fireEvent, fn } from 'storybook/test';
|
||||
|
||||
import { WithResults } from './FileSearchList.stories';
|
||||
import { FileSearchModal } from './FileSearchModal';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { FilterToggle } from './FilterToggle';
|
||||
|
||||
|
@ -5,10 +5,11 @@ import { ThemeProvider, useTheme } from 'storybook/internal/theming';
|
||||
import type { Theme } from 'storybook/internal/theming';
|
||||
|
||||
import type { Meta, StoryFn, StoryObj } from '@storybook/react';
|
||||
import { screen } from '@storybook/test';
|
||||
|
||||
import { action } from '@storybook/addon-actions';
|
||||
|
||||
import { screen } from 'storybook/test';
|
||||
|
||||
import { Heading } from './Heading';
|
||||
|
||||
type Story = StoryFn<typeof Heading>;
|
||||
|
@ -6,7 +6,8 @@ import { styled } from 'storybook/internal/theming';
|
||||
|
||||
import { LinkIcon } from '@storybook/icons';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, screen, userEvent, within } from '@storybook/test';
|
||||
|
||||
import { expect, screen, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { useMenu } from '../../container/Menu';
|
||||
import { LayoutProvider } from '../layout/LayoutProvider';
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { standardData as standardHeaderData } from './Heading.stories';
|
||||
import { IconSymbols } from './IconSymbols';
|
||||
|
@ -5,7 +5,8 @@ import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
import type { API_StatusState, Addon_SidebarTopType } from 'storybook/internal/types';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, fn, userEvent, within } from '@storybook/test';
|
||||
|
||||
import { expect, fn, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { LayoutProvider } from '../layout/LayoutProvider';
|
||||
import { standardData as standardHeaderData } from './Heading.stories';
|
||||
|
@ -4,7 +4,8 @@ import { type API, ManagerContext } from 'storybook/internal/manager-api';
|
||||
import { Addon_TypesEnum } from 'storybook/internal/types';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, fireEvent, fn, waitFor, within } from '@storybook/test';
|
||||
|
||||
import { expect, fireEvent, fn, waitFor, within } from 'storybook/test';
|
||||
|
||||
import { SidebarBottomBase } from './SidebarBottom';
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { findByRole, fn } from '@storybook/test';
|
||||
|
||||
import { findByRole, fn } from 'storybook/test';
|
||||
|
||||
import { TagsFilter } from './TagsFilter';
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { TagsFilterPanel } from './TagsFilterPanel';
|
||||
|
||||
|
@ -7,7 +7,8 @@ import { styled } from 'storybook/internal/theming';
|
||||
import { Addon_TypesEnum } from 'storybook/internal/types';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { fireEvent, fn } from '@storybook/test';
|
||||
|
||||
import { fireEvent, fn } from 'storybook/test';
|
||||
|
||||
import { TestingModule } from './TestingModule';
|
||||
|
||||
|
@ -8,10 +8,11 @@ import {
|
||||
} from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, fn, userEvent, within } from '@storybook/test';
|
||||
|
||||
import { action } from '@storybook/addon-actions';
|
||||
|
||||
import { expect, fn, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { DEFAULT_REF_ID } from './Sidebar';
|
||||
import { Tree } from './Tree';
|
||||
import { index } from './mockdata.large';
|
||||
|
@ -3,7 +3,8 @@ import React from 'react';
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { UpgradeBlock } from './UpgradeBlock';
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import UpgradeBlockStoriesMeta from '../components/upgrade/UpgradeBlock.stories';
|
||||
import { AboutScreen } from './About';
|
||||
|
@ -60,7 +60,7 @@ export class ImplicitActionsDuringRendering extends StorybookError {
|
||||
We detected that you use an implicit action arg while ${data.phase} of your story.
|
||||
${data.deprecated ? `\nThis is deprecated and won't work in Storybook 8 anymore.\n` : ``}
|
||||
Please provide an explicit spy to your args like this:
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
...
|
||||
args: {
|
||||
${data.name}: fn()
|
||||
|
@ -21,7 +21,7 @@ import type { StoreOptions } from './types';
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* import * as testUtils from '@storybook/test'; // in stories
|
||||
* import * as testUtils from 'storybook/test'; // in stories
|
||||
* import { vi as testUtils } from 'vitest'; // ... or in Vitest tests
|
||||
*
|
||||
* const initialState = { ... };
|
||||
|
@ -1,10 +1,10 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, it, test } from 'vitest';
|
||||
|
||||
import { expect, fn, isMockFunction, traverseArgs } from '@storybook/test';
|
||||
|
||||
import { action } from '@storybook/addon-actions';
|
||||
|
||||
import { expect, fn, isMockFunction, traverseArgs } from 'storybook/test';
|
||||
|
||||
it('storybook expect and fn can be used in vitest test', () => {
|
||||
const spy = fn();
|
||||
spy(1);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
const arrows = {
|
||||
ArrowUp: { name: 'ArrowUp' },
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -6,7 +6,7 @@ import {
|
||||
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
function pick(obj, keys) {
|
||||
const result = {};
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PlayFunctionContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect } from '@storybook/test';
|
||||
import { expect } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention,storybook/prefer-pascal-case */
|
||||
import { expect } from '@storybook/test';
|
||||
import { expect } from 'storybook/test';
|
||||
|
||||
const meta = {
|
||||
component: globalThis.Components.Button,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -12,7 +12,7 @@ import type {
|
||||
} from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect } from '@storybook/test';
|
||||
import { expect } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Button,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -2,7 +2,7 @@ import { useEffect, useState } from 'storybook/internal/preview-api';
|
||||
import type { PartialStoryFn, StoryContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { userEvent, within } from '@storybook/test';
|
||||
import { userEvent, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Button,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PlayFunctionContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect } from '@storybook/test';
|
||||
import { expect } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention,storybook/prefer-pascal-case */
|
||||
import { expect, userEvent as globalUserEvent, within } from '@storybook/test';
|
||||
import { expect, userEvent as globalUserEvent, within } from 'storybook/test';
|
||||
|
||||
const meta = {
|
||||
component: globalThis.Components.Button,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PartialStoryFn, StoryContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, fn, isMockFunction, mocked } from '@storybook/test';
|
||||
import { expect, fn, isMockFunction, mocked } from 'storybook/test';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore This alias is set in the sandbox. Using ts-ignore instead of ts-expect-error to avoid build errors in the sandbox.
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expect, fn } from '@storybook/test';
|
||||
import { expect, fn } from 'storybook/test';
|
||||
|
||||
const meta = { component: globalThis.Components.Button };
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PlayFunctionContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect } from '@storybook/test';
|
||||
import { expect } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
import type { PlayFunctionContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, waitFor, within } from '@storybook/test';
|
||||
import { expect, waitFor, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Button,
|
||||
|
@ -2,7 +2,7 @@ import { PREVIEW_KEYDOWN } from 'storybook/internal/core-events';
|
||||
import type { PlayFunctionContext } from 'storybook/internal/csf';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, fn, userEvent, within } from '@storybook/test';
|
||||
import { expect, fn, userEvent, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Form,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { expect, within } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PlayFunctionContext } from 'storybook/internal/types';
|
||||
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect } from '@storybook/test';
|
||||
import { expect } from 'storybook/test';
|
||||
|
||||
export default {
|
||||
component: globalThis.Components.Pre,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import * as utils from './utils.ts';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from '@storybook/angular';
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { ButtonComponent } from './button.component';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from '@storybook/angular';
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { HeaderComponent } from './header.component';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from '@storybook/angular';
|
||||
import { expect, userEvent, within } from '@storybook/test';
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { PageComponent } from './page.component';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Meta, StoryObj } from '@storybook/angular';
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import SignalButtonComponent from './button.component';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Meta, StoryObj } from '@storybook/angular';
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import SignalButtonComponent from './button.component';
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { linkTo } from '@storybook/addon-links';
|
||||
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
||||
export default {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||
type Callback = (...args: any[]) => Promise<any>;
|
||||
|
@ -1,13 +1,12 @@
|
||||
// We need this import to be a singleton, and because it's used in multiple entrypoints
|
||||
// both in ESM and CJS, importing it via the package name instead of having a local import
|
||||
// is the only way to achieve it actually being a singleton
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore we must ignore types here as during compilation they are not generated yet
|
||||
import { headers } from '@storybook/experimental-nextjs-vite/headers.mock';
|
||||
|
||||
import { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
class RequestCookiesMock extends RequestCookies {
|
||||
get = fn(super.get.bind(this)).mockName('next/headers::cookies().get');
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import { HeadersAdapter } from 'next/dist/server/web/spec-extension/adapters/headers';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
class HeadersAdapterMock extends HeadersAdapter {
|
||||
constructor() {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import { draftMode as originalDraftMode } from 'next/dist/server/request/draft-mode';
|
||||
import * as headers from 'next/dist/server/request/headers';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
// re-exports of the actual module
|
||||
export * from 'next/dist/server/request/headers';
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { NextjsRouterMocksNotAvailable } from 'storybook/internal/preview-errors';
|
||||
|
||||
import type { Mock } from '@storybook/test';
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import * as actual from 'next/dist/client/components/navigation';
|
||||
import { getRedirectError } from 'next/dist/client/components/redirect';
|
||||
import { RedirectStatusCode } from 'next/dist/client/components/redirect-status-code';
|
||||
import type { Mock } from 'storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
let navigationAPI: {
|
||||
push: Mock;
|
||||
|
@ -1,10 +1,9 @@
|
||||
import { NextjsRouterMocksNotAvailable } from 'storybook/internal/preview-errors';
|
||||
|
||||
import type { Mock } from '@storybook/test';
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import singletonRouter, * as originalRouter from 'next/dist/client/router';
|
||||
import type { NextRouter, SingletonRouter } from 'next/router';
|
||||
import type { Mock } from 'storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
const defaultRouterState = {
|
||||
route: '/',
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { Button } from './Button';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { fn } from '@storybook/test';
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { Header } from './Header';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expect, userEvent, within } from '@storybook/test';
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { Page } from './Page';
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { Button } from './Button';
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { fn } from '@storybook/test';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
import { Header } from './Header';
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, userEvent, within } from '@storybook/test';
|
||||
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
import { Page } from './Page';
|
||||
|
||||
|
@ -2,9 +2,9 @@ import React from 'react';
|
||||
|
||||
import type { Meta } from '@storybook/react';
|
||||
import type { StoryObj } from '@storybook/react';
|
||||
import { expect, waitFor } from '@storybook/test';
|
||||
|
||||
import Head from 'next/head';
|
||||
import { expect, waitFor } from 'storybook/test';
|
||||
|
||||
function Component() {
|
||||
return (
|
||||
|
@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, userEvent, within } from '@storybook/test';
|
||||
|
||||
import { getRouter } from '@storybook/experimental-nextjs-vite/navigation.mock';
|
||||
|
||||
@ -13,6 +12,7 @@ import {
|
||||
useSelectedLayoutSegment,
|
||||
useSelectedLayoutSegments,
|
||||
} from 'next/navigation';
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
function Component() {
|
||||
const router = useRouter();
|
||||
|
@ -1,9 +1,10 @@
|
||||
import type { Meta } from '@storybook/react';
|
||||
import type { StoryObj } from '@storybook/react';
|
||||
import { expect, userEvent, within } from '@storybook/test';
|
||||
|
||||
import { cookies, headers } from '@storybook/experimental-nextjs-vite/headers.mock';
|
||||
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
import NextHeader from './NextHeader';
|
||||
|
||||
export default {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { userEvent, within } from '@storybook/test';
|
||||
|
||||
import { redirect } from 'next/navigation';
|
||||
import { userEvent, within } from 'storybook/test';
|
||||
|
||||
let state = 'Bug! Not invalidated';
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, userEvent, within } from '@storybook/test';
|
||||
|
||||
import { getRouter } from '@storybook/experimental-nextjs-vite/router.mock';
|
||||
|
||||
import Router, { useRouter } from 'next/router';
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
function Component() {
|
||||
const router = useRouter();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user