Skip to content

Commit

Permalink
Merge pull request #26351 from storybookjs/norbert/remove-testing-lib
Browse files Browse the repository at this point in the history
Maintenance: Replace `@storybook/testing-library` with `@storybook/test` in monorepo
  • Loading branch information
ndelangen authored Mar 7, 2024
2 parents 3d3a326 + e4a47f5 commit 3fc8363
Show file tree
Hide file tree
Showing 40 changed files with 39 additions and 85 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { global as globalThis } from '@storybook/global';
import { expect } from '@storybook/test';
import { within } from '@storybook/testing-library';
import { expect, within } from '@storybook/test';

export default {
component: globalThis.Components.Pre,
Expand Down
2 changes: 1 addition & 1 deletion code/addons/interactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@storybook/instrumenter": "workspace:*",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/testing-library": "next",
"@storybook/test": "workspace:*",
"@storybook/theming": "workspace:*",
"@types/node": "^18.0.0",
"formik": "^2.2.9",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { StoryObj, Meta } from '@storybook/react';
import { expect } from '@storybook/test';
import { CallStates } from '@storybook/instrumenter';
import { userEvent, within } from '@storybook/testing-library';
import { userEvent, within, expect } from '@storybook/test';
import { getCalls } from '../mocks';

import { Interaction } from './Interaction';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React from 'react';
import type { StoryObj, Meta } from '@storybook/react';
import { CallStates } from '@storybook/instrumenter';
import { styled } from '@storybook/theming';
import { userEvent, within, waitFor } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { userEvent, within, waitFor, expect } from '@storybook/test';
import isChromatic from 'chromatic/isChromatic';

import { getCalls, getInteractions } from '../mocks';
Expand Down
1 change: 0 additions & 1 deletion code/addons/onboarding/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"@storybook/react": "workspace:*",
"@storybook/telemetry": "workspace:*",
"@storybook/test": "workspace:*",
"@storybook/testing-library": "next",
"@storybook/theming": "workspace:*",
"@storybook/types": "workspace:*",
"framer-motion": "^11.0.3",
Expand Down
3 changes: 1 addition & 2 deletions code/addons/onboarding/src/components/List/List.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { userEvent, waitFor, within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { userEvent, waitFor, within, expect } from '@storybook/test';

import { List } from './List';
import { ListItem } from './ListItem/ListItem';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { userEvent, within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { userEvent, within, expect } from '@storybook/test';

import { Modal } from './Modal';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react';
import { PulsatingEffect } from './PulsatingEffect';
import React from 'react';
import { within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, expect } from '@storybook/test';

const meta: Meta<typeof PulsatingEffect> = {
component: PulsatingEffect,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import type { Meta, StoryObj } from '@storybook/react';

import { waitFor, within } from '@storybook/testing-library';
import { expect, fn } from '@storybook/test';
import { waitFor, within, expect, fn } from '@storybook/test';
import { STORY_INDEX_INVALIDATED, STORY_RENDERED } from '@storybook/core-events';
import { WriteStoriesModal } from './WriteStoriesModal';
import typescriptSnippet from './code/typescript';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Meta, StoryObj, applicationConfig } from '@storybook/angular';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { within, userEvent } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, userEvent, expect } from '@storybook/test';
import { importProvidersFrom } from '@angular/core';
import { OpenCloseComponent } from '../moduleMetadata/angular-src/open-close-component/open-close.component';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Meta, StoryObj } from '@storybook/angular';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { within, userEvent } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, userEvent, expect } from '@storybook/test';
import { importProvidersFrom } from '@angular/core';
import { OpenCloseComponent } from '../moduleMetadata/angular-src/open-close-component/open-close.component';

Expand Down
1 change: 0 additions & 1 deletion code/frameworks/nextjs/template/stories/Image.stories.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useRef, useState } from 'react';
import Image from 'next/image';
import { waitFor } from '@storybook/testing-library';

import Accessibility from '../../assets/accessibility.svg';
import AvifImage from '../../assets/avif-test-image.avif';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@storybook/test';
import Head from 'next/head';
import React from 'react';
import { within, userEvent, waitFor } from '@storybook/testing-library';
import { waitFor, expect } from '@storybook/test';

function Component() {
return (
Expand Down
3 changes: 1 addition & 2 deletions code/lib/preview-api/template/stories/argMapping.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { global as globalThis } from '@storybook/global';
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from '@storybook/types';
import { within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, expect } from '@storybook/test';

const arrows = {
ArrowUp: { name: 'ArrowUp' },
Expand Down
3 changes: 1 addition & 2 deletions code/lib/preview-api/template/stories/argTypes.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { global as globalThis } from '@storybook/global';
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from '@storybook/types';
import { within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { expect, within } from '@storybook/test';

export default {
component: globalThis.Components.Pre,
Expand Down
3 changes: 1 addition & 2 deletions code/lib/preview-api/template/stories/args.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { global as globalThis } from '@storybook/global';
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from '@storybook/types';
import { within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, expect } from '@storybook/test';
import pick from 'lodash/pick';
import { STORY_ARGS_UPDATED, UPDATE_STORY_ARGS, RESET_STORY_ARGS } from '@storybook/core-events';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { global as globalThis } from '@storybook/global';
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from '@storybook/types';
import { within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, expect } from '@storybook/test';

export default {
component: globalThis.Components.Pre,
Expand Down
3 changes: 1 addition & 2 deletions code/lib/preview-api/template/stories/decorators.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import type {
PlayFunctionContext,
StoryContext,
} from '@storybook/types';
import { within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, expect } from '@storybook/test';
import { useEffect } from '@storybook/preview-api';
import { STORY_ARGS_UPDATED, UPDATE_STORY_ARGS, RESET_STORY_ARGS } from '@storybook/core-events';

Expand Down
3 changes: 1 addition & 2 deletions code/lib/preview-api/template/stories/globals.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { global as globalThis } from '@storybook/global';
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from '@storybook/types';
import { within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, expect } from '@storybook/test';

export default {
component: globalThis.Components.Pre,
Expand Down
2 changes: 1 addition & 1 deletion code/lib/preview-api/template/stories/hooks.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { global as globalThis } from '@storybook/global';
import type { PartialStoryFn, PlayFunctionContext } from '@storybook/types';
import { useEffect, useState } from '@storybook/preview-api';
import { within, userEvent } from '@storybook/testing-library';
import { within, userEvent } from '@storybook/test';

export default {
component: globalThis.Components.Button,
Expand Down
3 changes: 1 addition & 2 deletions code/lib/preview-api/template/stories/loaders.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { global as globalThis } from '@storybook/global';
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from '@storybook/types';
import { within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, expect } from '@storybook/test';

export default {
component: globalThis.Components.Pre,
Expand Down
3 changes: 1 addition & 2 deletions code/lib/preview-api/template/stories/parameters.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { global as globalThis } from '@storybook/global';
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from '@storybook/types';
import { within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, expect } from '@storybook/test';

export default {
component: globalThis.Components.Pre,
Expand Down
3 changes: 1 addition & 2 deletions code/lib/preview-api/template/stories/rendering.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { global as globalThis } from '@storybook/global';
import type { PlayFunctionContext } from '@storybook/types';
import { within, waitFor } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, waitFor, expect } from '@storybook/test';
import {
FORCE_REMOUNT,
RESET_STORY_ARGS,
Expand Down
3 changes: 1 addition & 2 deletions code/lib/preview-api/template/stories/shortcuts.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { global as globalThis } from '@storybook/global';
import { userEvent, within } from '@storybook/testing-library';
import { userEvent, within, expect, fn } from '@storybook/test';
import { PREVIEW_KEYDOWN } from '@storybook/core-events';
import { expect, fn } from '@storybook/test';
import type { PlayFunctionContext } from '@storybook/csf';

export default {
Expand Down
3 changes: 1 addition & 2 deletions code/lib/preview-api/template/stories/tags.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { global as globalThis } from '@storybook/global';
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from '@storybook/types';
import { within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, expect } from '@storybook/test';

export default {
component: globalThis.Components.Pre,
Expand Down
10 changes: 2 additions & 8 deletions code/renderers/svelte/template/stories/args.stories.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { expect } from '@storybook/test';
import { within, userEvent, waitFor } from '@storybook/testing-library';
import {
UPDATE_STORY_ARGS,
STORY_ARGS_UPDATED,
RESET_STORY_ARGS,
STORY_RENDERED,
} from '@storybook/core-events';
import { within, userEvent, waitFor, expect } from '@storybook/test';
import { UPDATE_STORY_ARGS, RESET_STORY_ARGS, STORY_RENDERED } from '@storybook/core-events';
import { addons } from '@storybook/preview-api';
import ButtonView from './views/ButtonJavaScript.svelte';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from '@storybook/test';
import type { Meta, StoryObj } from '@storybook/vue3';
import { within } from '@storybook/testing-library';
import { within, expect } from '@storybook/test';
import { inject } from 'vue';
import GlobalSetup from './GlobalSetup.vue';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@storybook/test';
import { global as globalThis } from '@storybook/global';
import type { Meta, StoryObj, StoryFn } from '@storybook/vue3';
import { within, userEvent } from '@storybook/testing-library';
import { within, userEvent, expect } from '@storybook/test';
import { UPDATE_STORY_ARGS, STORY_ARGS_UPDATED, RESET_STORY_ARGS } from '@storybook/core-events';

import ReactiveArgs from './ReactiveArgs.vue';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { global as globalThis } from '@storybook/global';
import { userEvent, within } from '@storybook/testing-library';
import { userEvent, within } from '@storybook/test';
import type { Meta, StoryObj } from '@storybook/vue3';
import { h } from 'vue';
import { RESET_STORY_ARGS, STORY_ARGS_UPDATED, UPDATE_STORY_ARGS } from '@storybook/core-events';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from '@storybook/test';
import { global as globalThis } from '@storybook/global';
import { within } from '@storybook/testing-library';
import { within, expect } from '@storybook/test';
import { STORY_ARGS_UPDATED, RESET_STORY_ARGS, UPDATE_STORY_ARGS } from '@storybook/core-events';
import { h } from 'vue';
import type { Meta, StoryObj } from '@storybook/vue3';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@storybook/test';
import { global as globalThis } from '@storybook/global';
import type { Channel } from '@storybook/channels';
import { within } from '@storybook/testing-library';
import { within, expect } from '@storybook/test';
import { UPDATE_STORY_ARGS, STORY_ARGS_UPDATED, RESET_STORY_ARGS } from '@storybook/core-events';

import type { Meta, StoryObj } from '@storybook/vue3';
Expand Down
2 changes: 1 addition & 1 deletion code/ui/blocks/src/components/Story.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import type { Meta, ReactRenderer, StoryObj } from '@storybook/react';
import { within } from '@storybook/testing-library';
import { within } from '@storybook/test';
import type { PlayFunctionContext } from '@storybook/csf';
import type { WebRenderer, ModuleExport } from '@storybook/types';
import { RESET_STORY_ARGS, STORY_ARGS_UPDATED, UPDATE_STORY_ARGS } from '@storybook/core-events';
Expand Down
3 changes: 1 addition & 2 deletions code/ui/blocks/src/controls/Boolean.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from '@storybook/test';
import type { Meta, StoryObj } from '@storybook/react';
import { within, fireEvent, waitFor } from '@storybook/testing-library';
import { within, fireEvent, waitFor, expect } from '@storybook/test';
import { addons } from '@storybook/preview-api';
import { RESET_STORY_ARGS, STORY_ARGS_UPDATED } from '@storybook/core-events';
import { BooleanControl } from './Boolean';
Expand Down
3 changes: 1 addition & 2 deletions code/ui/blocks/src/examples/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from '@storybook/test';
import type { Meta, StoryObj } from '@storybook/react';
import { within, fireEvent } from '@storybook/testing-library';
import { within, fireEvent, expect } from '@storybook/test';
import React from 'react';
import { Button } from './Button';

Expand Down
9 changes: 1 addition & 8 deletions code/ui/components/src/components/tabs/tabs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ import { expect } from '@storybook/test';
import React, { Fragment } from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta, StoryObj } from '@storybook/react';
import {
within,
fireEvent,
waitFor,
screen,
userEvent,
findByText,
} from '@storybook/testing-library';
import { within, fireEvent, waitFor, screen, userEvent, findByText } from '@storybook/test';
import { CPUIcon, MemoryIcon } from '@storybook/icons';
import { Tabs, TabsState, TabWrapper } from './tabs';
import type { ChildrenList } from './tabs.helpers';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react';
import { ManagerContext } from '@storybook/manager-api';
import React, { useEffect } from 'react';
import { within } from '@storybook/testing-library';
import { within } from '@storybook/test';
import { MobileAbout } from './MobileAbout';
import { LayoutProvider, useLayout } from '../../layout/LayoutProvider';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react';
import React from 'react';
import { ManagerContext } from '@storybook/manager-api';
import { within } from '@storybook/testing-library';
import { within } from '@storybook/test';
import { startCase } from 'lodash';
import { MobileNavigation } from './MobileNavigation';
import { LayoutProvider, useLayout } from '../../layout/LayoutProvider';
Expand Down
3 changes: 1 addition & 2 deletions code/ui/manager/src/components/sidebar/Menu.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { ComponentProps } from 'react';
import React from 'react';
import { expect } from '@storybook/test';
import type { Meta, StoryObj } from '@storybook/react';

import { TooltipLinkList } from '@storybook/components';
import { styled } from '@storybook/theming';
import { screen, userEvent, within } from '@storybook/testing-library';
import { screen, userEvent, within, expect } from '@storybook/test';
import type { State } from '@storybook/manager-api';
import { LinkIcon } from '@storybook/icons';
import { SidebarMenu } from './Menu';
Expand Down
4 changes: 1 addition & 3 deletions code/ui/manager/src/components/sidebar/Tree.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import type { ComponentEntry, IndexHash } from '@storybook/manager-api';
import { action } from '@storybook/addon-actions';

import type { StoryObj, Meta } from '@storybook/react';
import { within } from '@storybook/testing-library';

import { expect } from '@storybook/test';
import { within, expect } from '@storybook/test';
import { Tree } from './Tree';
import { index } from './mockdata.large';
import { DEFAULT_REF_ID } from './Sidebar';
Expand Down
3 changes: 1 addition & 2 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5121,7 +5121,7 @@ __metadata:
"@storybook/instrumenter": "workspace:*"
"@storybook/manager-api": "workspace:*"
"@storybook/preview-api": "workspace:*"
"@storybook/testing-library": "npm:next"
"@storybook/test": "workspace:*"
"@storybook/theming": "workspace:*"
"@storybook/types": "workspace:*"
"@types/node": "npm:^18.0.0"
Expand Down Expand Up @@ -5223,7 +5223,6 @@ __metadata:
"@storybook/react": "workspace:*"
"@storybook/telemetry": "workspace:*"
"@storybook/test": "workspace:*"
"@storybook/testing-library": "npm:next"
"@storybook/theming": "workspace:*"
"@storybook/types": "workspace:*"
framer-motion: "npm:^11.0.3"
Expand Down

0 comments on commit 3fc8363

Please sign in to comment.