Rename @storybook/test to storybook/test

This commit is contained in:
Valentin Palkovic 2025-03-03 21:40:10 +01:00
parent 7ae3d68b70
commit d3087816c0
200 changed files with 447 additions and 392 deletions

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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,

View File

@ -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 = {

View File

@ -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

View File

@ -1,4 +1,4 @@
import { expect, within } from '@storybook/test';
import { expect, within } from 'storybook/test';
export default {
component: globalThis.Components.Pre,

View File

@ -1,4 +1,4 @@
import { fn } from '@storybook/test';
import { fn } from 'storybook/test';
export default {
component: globalThis.Components.Button,

View File

@ -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 {

View File

@ -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';

View File

@ -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';

View File

@ -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,

View File

@ -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,

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -7,7 +7,7 @@ import {
waitFor,
waitForElementToBeRemoved,
within,
} from '@storybook/test';
} from 'storybook/test';
export default {
component: globalThis.Components.Form,

View File

@ -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,

View File

@ -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';

View File

@ -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"
},

View File

@ -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',

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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 = {

View File

@ -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';

View File

@ -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';

View File

@ -1,4 +1,4 @@
import { fn } from '@storybook/test';
import { fn } from 'storybook/test';
import { FilterToggle } from './FilterToggle';

View File

@ -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>;

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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()

View File

@ -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 = { ... };

View File

@ -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);

View File

@ -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' },

View File

@ -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,

View File

@ -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 = {};

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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.

View File

@ -1,4 +1,4 @@
import { expect, fn } from '@storybook/test';
import { expect, fn } from 'storybook/test';
const meta = { component: globalThis.Components.Button };

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -1,4 +1,4 @@
import { fn } from '@storybook/test';
import { fn } from 'storybook/test';
import * as utils from './utils.ts';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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 {

View File

@ -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>;

View File

@ -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');

View File

@ -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() {

View File

@ -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';

View File

@ -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;

View File

@ -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: '/',

View File

@ -1,4 +1,4 @@
import { fn } from '@storybook/test';
import { fn } from 'storybook/test';
import { Button } from './Button';

View File

@ -1,4 +1,4 @@
import { fn } from '@storybook/test';
import { fn } from 'storybook/test';
import { Header } from './Header';

View File

@ -1,4 +1,4 @@
import { expect, userEvent, within } from '@storybook/test';
import { expect, userEvent, within } from 'storybook/test';
import { Page } from './Page';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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 (

View File

@ -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();

View File

@ -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 {

View File

@ -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';

View File

@ -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