repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/order-of-hooks.stories.ts | code/core/template/stories/order-of-hooks.stories.ts | import { expect, getByRole, mocked, spyOn, userEvent } from 'storybook/test';
const meta = {
component: globalThis.__TEMPLATE_COMPONENTS__.Button,
loaders() {
spyOn(console, 'log').mockName('console.log');
console.log('1 - [from loaders]');
},
beforeEach() {
console.log('2 - [from meta beforeEach]'... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/preview.ts | code/core/template/stories/preview.ts | import type { PartialStoryFn, StoryContext } from 'storybook/internal/types';
import type { ReactRenderer } from '@storybook/react';
declare global {
interface Window {
__STORYBOOK_BEFORE_ALL_CALLS__: number;
__STORYBOOK_BEFORE_ALL_CLEANUP_CALLS__: number;
}
}
try {
// This is used to test the hooks in... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/unicode.stories.ts | code/core/template/stories/unicode.stories.ts | import { global as globalThis } from '@storybook/global';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Button,
id: '😀',
tags: ['autodocs'],
};
export const Кнопки = {
args: { label: 'Кнопки' },
};
export const 바보 = {
args: { label: '바보' },
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/utils.ts | code/core/template/stories/utils.ts | export const foo = () => 'not mocked';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/global.d.ts | code/core/template/stories/global.d.ts | export {};
declare global {
var __TEMPLATE_COMPONENTS__: any;
var __STORYBOOK_ADDONS_CHANNEL__: {
emit: any;
on: any;
};
var storybookRenderer: string;
}
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/component-play.stories.ts | code/core/template/stories/component-play.stories.ts | import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect, within } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
play: async ({ canvasElement, name }: P... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/autotitle.stories.ts | code/core/template/stories/autotitle.stories.ts | import type { PlayFunctionContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
args: { text: 'No content' },
};
export const Default = {
play: async ({ t... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/interleavedExports.stories.ts | code/core/template/stories/interleavedExports.stories.ts | import { global as globalThis } from '@storybook/global';
import './import';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
args: { text: 'Check that stories are processed OK' },
};
export const Story1 = {};
export const Story2 = {};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/component-test.basics.stories.ts | code/core/template/stories/component-test.basics.stories.ts | import { global as globalThis } from '@storybook/global';
import {
expect,
fireEvent,
fn,
userEvent as testUserEvent,
waitFor,
waitForElementToBeRemoved,
within,
} from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Form,
args: {
onSuccess: fn(),
},
globals:... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/argtype.stories.ts | code/core/template/stories/argtype.stories.ts | import { global as globalThis } from '@storybook/global';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Button,
args: {
label: 'Click Me!',
},
argTypes: {
onClick: {},
},
parameters: {
chromatic: { disableSnapshot: true },
actions: { argTypesRegex: '^on.*' },
},
};
expor... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/basics.stories.ts | code/core/template/stories/basics.stories.ts | import { global as globalThis } from '@storybook/global';
import { action } from 'storybook/actions';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Button,
args: {
label: 'Click Me!',
},
parameters: {
chromatic: { disableSnapshot: true },
},
};
export const Basic = {
args: { onCl... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/tags-remove.stories.ts | code/core/template/stories/tags-remove.stories.ts | import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect, within } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
tags: ['component-one', 'autodocs'],
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/expect.stories.tsx | code/core/template/stories/expect.stories.tsx | import React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { expect } from 'storybook/test';
const meta = {
component: globalThis.__TEMPLATE_COMPONENTS__.Button,
} satisfies Meta;
export default meta;
type Story = StoryObj<typeof meta>;
export const ExpectInstrumentation: Story = {... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/title.stories.ts | code/core/template/stories/title.stories.ts | import type { PlayFunctionContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
title: 'manual title',
args: { text: 'No content' },
};
export const Defau... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/spies.stories.ts | code/core/template/stories/spies.stories.ts | import { global as globalThis } from '@storybook/global';
import { spyOn } from 'storybook/test';
const meta = {
component: globalThis.__TEMPLATE_COMPONENTS__.Button,
beforeEach() {
spyOn(console, 'log').mockName('console.log');
console.log('first');
},
};
export default meta;
export const ShowSpyOnIn... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/hooks.stories.ts | code/core/template/stories/hooks.stories.ts | import type { PartialStoryFn, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { useEffect, useState } from 'storybook/preview-api';
import { userEvent, within } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.But... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/before-each.stories.ts | code/core/template/stories/before-each.stories.ts | /* eslint-disable storybook/prefer-pascal-case */
import { expect } from 'storybook/test';
const meta = {
component: globalThis.__TEMPLATE_COMPONENTS__.Button,
args: { label: 'Button' },
};
export default meta;
export const before_each_and_loaders_can_extend_context = {
parameters: { chromatic: { disableSnapsh... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/indexer.stories.ts | code/core/template/stories/indexer.stories.ts | import type { PlayFunctionContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
args: { text: 'Check that id assertions in interaction tests are passing' },
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/args.stories.ts | code/core/template/stories/args.stories.ts | import {
RESET_STORY_ARGS,
STORY_ARGS_UPDATED,
UPDATE_STORY_ARGS,
} from 'storybook/internal/core-events';
import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect, within } from 'storybook/test';... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/utils.mock.ts | code/core/template/stories/utils.mock.ts | import { fn } from 'storybook/test';
import * as utils from './utils.ts';
export const foo = fn(utils.foo).mockName('foo');
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/destructuring-not-transpiled.stories.ts | code/core/template/stories/destructuring-not-transpiled.stories.ts | import { global as globalThis } from '@storybook/global';
import { expect } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Button,
args: { label: 'Button' },
};
// We must not transpile destructuring, to make sure that we can analyze the context properties that are used in ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/component-test.unhandled-errors.stories.ts | code/core/template/stories/component-test.unhandled-errors.stories.ts | import { global as globalThis } from '@storybook/global';
import { userEvent, within } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Button,
args: {
label: 'Button',
// onClick: fn(), <-- this is intentionally missing to trigger an unhandled error
},
argTypes: {... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/parameters.stories.ts | code/core/template/stories/parameters.stories.ts | import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect, within } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
parameters: {
componentParameter: '... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/tags-add.stories.ts | code/core/template/stories/tags-add.stories.ts | import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect, within } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
tags: ['!dev', '!autodocs', '!test'],
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/shortcuts.stories.ts | code/core/template/stories/shortcuts.stories.ts | 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';
export default {
component: globalThis.__TEMPLATE_COMPONENTS... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/argMapping.stories.ts | code/core/template/stories/argMapping.stories.ts | import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect, within } from 'storybook/test';
const arrows = {
ArrowUp: { name: 'ArrowUp' },
ArrowDown: { name: 'ArrowDown' },
ArrowLeft: { name: 'Arro... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/loaders.stories.ts | code/core/template/stories/loaders.stories.ts | import type { PartialStoryFn, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect, within } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
loaders: [async () => new Promise((r) => setTimeout(() => r(... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/exportOrder.stories.ts | code/core/template/stories/exportOrder.stories.ts | import { global as globalThis } from '@storybook/global';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
args: { text: 'Check that Story2 is listed before Story1' },
};
export const Story1 = {};
export const Story2 = {};
export const __namedExportsOrder = ['Story2', 'Story1'];
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/tags-config.stories.ts | code/core/template/stories/tags-config.stories.ts | import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect, within } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
tags: ['component-one', 'component-two'... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/decorators.stories.ts | code/core/template/stories/decorators.stories.ts | import {
RESET_STORY_ARGS,
STORY_ARGS_UPDATED,
UPDATE_STORY_ARGS,
} from 'storybook/internal/core-events';
import type {
ArgsStoryFn,
PartialStoryFn,
PlayFunctionContext,
StoryContext,
} from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { useEffect } from ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/configs.stories.ts | code/core/template/stories/configs.stories.ts | import { global as globalThis } from '@storybook/global';
import { actions, configureActions } from 'storybook/actions';
const configs = actions('actionA', 'actionB', 'actionC');
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Button,
args: {
label: 'Click Me!',
},
parameters: {
chroma... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/moduleMocking.stories.ts | code/core/template/stories/moduleMocking.stories.ts | import { global as globalThis } from '@storybook/global';
// 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.
import { foo } from '#utils';
import { expect, fn, isMockFunction, moc... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/parameters-actions.stories.ts | code/core/template/stories/parameters-actions.stories.ts | import { global as globalThis } from '@storybook/global';
import { withActions } from 'storybook/actions/decorator';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Button,
args: {
label: 'Click Me!',
},
parameters: {
chromatic: { disableSnapshot: true },
},
};
export const Basic = {... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/argTypes.stories.ts | code/core/template/stories/argTypes.stories.ts | import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect, within } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
// Compose all the argTypes into `objec... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/toolbars/globals.stories.ts | code/core/template/stories/toolbars/globals.stories.ts | import type { DecoratorFunction } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
const greetingForLocale = (locale: string) => {
switch (locale) {
case 'es':
return 'Hola!';
case 'fr':
return 'Bonjour !';
case 'zh':
return '你好!';
case 'kr... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/test/ModuleSpyMocking.utils.ts | code/core/template/stories/test/ModuleSpyMocking.utils.ts | export function fn() {
return ['original value'];
}
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/test/ModuleAutoMocking.utils.ts | code/core/template/stories/test/ModuleAutoMocking.utils.ts | export function fn() {
return ['original value'];
}
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/test/ModuleAutoMocking.stories.ts | code/core/template/stories/test/ModuleAutoMocking.stories.ts | import { global as globalThis } from '@storybook/global';
import { expect } from 'storybook/test';
import { v4 } from 'uuid';
import { fn } from './ModuleAutoMocking.utils';
// This story demonstrates module mocking. The imported util function is automocked,
// because a __mocks__/ModuleAutoMocking.utils.ts file exi... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/test/ModuleMocking.utils.ts | code/core/template/stories/test/ModuleMocking.utils.ts | export function fn() {
return ['original value'];
}
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/test/ModuleSpyMocking.stories.ts | code/core/template/stories/test/ModuleSpyMocking.stories.ts | import { global as globalThis } from '@storybook/global';
import { expect, mocked } from 'storybook/test';
import { fn } from './ModuleSpyMocking.utils';
// This story demonstrates module mocking with spies. The imported util function is autospied,
// meaning that it is mocked automatically by Storybook, because the... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/test/ModuleMocking.stories.ts | code/core/template/stories/test/ModuleMocking.stories.ts | import { global as globalThis } from '@storybook/global';
import { expect, mocked } from 'storybook/test';
import { fn } from './ModuleMocking.utils';
// This story demonstrates auto module mocking. The imported util function is mocked in the
// .storybook/preview.js file via sb.mock(module) but a
// mock is not pro... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/test/__mocks__/ModuleAutoMocking.utils.ts | code/core/template/stories/test/__mocks__/ModuleAutoMocking.utils.ts | export function fn() {
return ['automocked value'];
}
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/viewport/globals.stories.ts | code/core/template/stories/viewport/globals.stories.ts | import { global as globalThis } from '@storybook/global';
import { MINIMAL_VIEWPORTS } from 'storybook/viewport';
const first = Object.keys(MINIMAL_VIEWPORTS)[0];
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
args: {
text: 'Testing the viewport',
},
parameters: {
chromatic: { di... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/controls/conditional.stories.ts | code/core/template/stories/controls/conditional.stories.ts | import type { PartialStoryFn, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
decorators: [
(storyFn: PartialStoryFn, context: StoryContext) =>
storyFn({ args: { object: { ...con... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/controls/matchers.stories.ts | code/core/template/stories/controls/matchers.stories.ts | import type { PartialStoryFn, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
decorators: [
(storyFn: PartialStoryFn, context: StoryContext) =>
storyFn({ args: { object: { ...con... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/controls/issues.stories.ts | code/core/template/stories/controls/issues.stories.ts | import type { PartialStoryFn, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
decorators: [
(storyFn: PartialStoryFn, context: StoryContext) =>
storyFn({ args: { object: { ...con... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/controls/disable.stories.ts | code/core/template/stories/controls/disable.stories.ts | import type { PartialStoryFn, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
decorators: [
(storyFn: PartialStoryFn, context: StoryContext) =>
storyFn({ args: { object: { ...con... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/controls/basics.stories.ts | code/core/template/stories/controls/basics.stories.ts | import type { PartialStoryFn, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
decorators: [
(storyFn: PartialStoryFn, context: StoryContext) =>
storyFn({ args: { object: { ...con... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/controls/sorting.stories.ts | code/core/template/stories/controls/sorting.stories.ts | import type { PartialStoryFn, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
decorators: [
(storyFn: PartialStoryFn, context: StoryContext) =>
storyFn({ args: { object: { ...con... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/controls/filters.stories.ts | code/core/template/stories/controls/filters.stories.ts | import type { PartialStoryFn, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
decorators: [
(storyFn: PartialStoryFn, context: StoryContext) =>
storyFn({ args: { object: { ...con... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/backgrounds/globals.stories.ts | code/core/template/stories/backgrounds/globals.stories.ts | import { global as globalThis } from '@storybook/global';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
args: {
text: 'Testing the background',
},
parameters: {
chromatic: { disableSnapshot: true },
backgrounds: {
options: {
red: { name: 'light', value: 'red' },
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/create-react-app/build-config.ts | code/presets/create-react-app/build-config.ts | import type { BuildEntries } from '../../../scripts/build/utils/entry-utils';
const config: BuildEntries = {
entries: {
node: [
{
exportEntries: ['./index', './preset'],
entryPoint: './src/index.ts',
dts: false,
},
],
},
};
export default config;
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/create-react-app/src/typings.d.ts | code/presets/create-react-app/src/typings.d.ts | declare module 'pnp-webpack-plugin';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/create-react-app/src/types.ts | code/presets/create-react-app/src/types.ts | import type { Options } from 'storybook/internal/types';
import type { PluginOptions as RDTSPluginOptions } from '@storybook/react-docgen-typescript-plugin';
export interface PluginOptions extends Options {
/**
* Optionally set the package name of a react-scripts fork. In most cases, the package is located
* ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/create-react-app/src/index.ts | code/presets/create-react-app/src/index.ts | import module from 'node:module';
import { dirname, join, relative } from 'node:path';
import { logger } from 'storybook/internal/node-logger';
// TODO: Remove in SB11
import PnpWebpackPlugin from 'pnp-webpack-plugin';
import type { Configuration, RuleSetRule, WebpackPluginInstance } from 'webpack';
import { checkPr... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/create-react-app/src/helpers/getReactScriptsPath.ts | code/presets/create-react-app/src/helpers/getReactScriptsPath.ts | import { lstatSync, readFileSync, realpathSync } from 'node:fs';
import { join } from 'node:path';
import { resolvePackageDir } from '../../../../core/src/shared/utils/module';
export const getReactScriptsPath = (): string => {
const cwd = process.cwd();
const scriptsBinPath = join(cwd, '/node_modules/.bin/react-... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/create-react-app/src/helpers/getModulePath.ts | code/presets/create-react-app/src/helpers/getModulePath.ts | import { existsSync } from 'node:fs';
import { join } from 'node:path';
interface PartialTSConfig {
compilerOptions: {
baseUrl?: string;
};
}
const JSCONFIG = 'jsconfig.json';
const TSCONFIG = 'tsconfig.json';
export const getModulePath = (appDirectory: string): string[] => {
// CRA only supports `jsconfig... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/create-react-app/src/helpers/mergePlugins.ts | code/presets/create-react-app/src/helpers/mergePlugins.ts | import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
import type { Configuration, WebpackPluginInstance } from 'webpack';
export const mergePlugins = (...args: WebpackPluginInstance[]): Configuration['plugins'] =>
args?.reduce((plugins, plugin) => {
if (
plugins?.some(
(inc... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/create-react-app/src/helpers/processCraConfig.ts | code/presets/create-react-app/src/helpers/processCraConfig.ts | import { resolve } from 'node:path';
import type { PluginItem, TransformOptions } from '@babel/core';
import semver from 'semver';
import type { Configuration, RuleSetCondition, RuleSetRule } from 'webpack';
import type { PluginOptions } from '../types';
type RuleSetConditions = RuleSetCondition[];
const isRegExp =... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/create-react-app/src/helpers/checkPresets.ts | code/presets/create-react-app/src/helpers/checkPresets.ts | import { logger } from 'storybook/internal/node-logger';
import type { PluginOptions } from '../types';
const incompatiblePresets = ['@storybook/preset-scss', '@storybook/preset-typescript'];
export const checkPresets = (options: PluginOptions): void => {
const { presetsList } = options;
presetsList?.forEach((p... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/server-webpack/vitest.config.ts | code/presets/server-webpack/vitest.config.ts | import { defineConfig, mergeConfig } from 'vitest/config';
import { vitestCommonConfig } from '../../vitest.shared';
export default mergeConfig(
vitestCommonConfig,
defineConfig({
// Add custom config here
})
);
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/server-webpack/build-config.ts | code/presets/server-webpack/build-config.ts | import type { BuildEntries } from '../../../scripts/build/utils/entry-utils';
const config: BuildEntries = {
entries: {
node: [
{
exportEntries: ['.'],
entryPoint: './src/index.ts',
},
{
exportEntries: ['./loader'],
entryPoint: './src/loader.ts',
dts: fal... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/server-webpack/src/typings.d.ts | code/presets/server-webpack/src/typings.d.ts | // will be provided by the webpack define plugin
declare var NODE_ENV: string | undefined;
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/server-webpack/src/loader.ts | code/presets/server-webpack/src/loader.ts | import { compileCsfModule } from './lib/compiler';
export default (content: string) => {
try {
const after = compileCsfModule(JSON.parse(content));
return after;
} catch (e) {
// for debugging
console.log(content, e);
}
return content;
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/server-webpack/src/types.ts | code/presets/server-webpack/src/types.ts | export type { BuilderResult, TypescriptOptions, StorybookConfig } from '@storybook/core-webpack';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/server-webpack/src/index.ts | code/presets/server-webpack/src/index.ts | import { fileURLToPath } from 'node:url';
import type { StorybookConfig } from './types';
export * from './types';
export const webpack: StorybookConfig['webpack'] = (config) => {
const rules = [
...(config.module?.rules || []),
{
type: 'javascript/auto',
test: /\.stories\.json$/,
use: fi... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/server-webpack/src/lib/compiler/stringifier.ts | code/presets/server-webpack/src/lib/compiler/stringifier.ts | import { identifier } from 'safe-identifier';
import { dedent } from 'ts-dedent';
import type { StorybookSection, StorybookStory } from './types';
export function stringifyObject(object: any, level = 0, excludeOuterParams = false): string {
if (typeof object === 'string') {
return JSON.stringify(object);
}
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/server-webpack/src/lib/compiler/json-to-csf-compiler.test.ts | code/presets/server-webpack/src/lib/compiler/json-to-csf-compiler.test.ts | import { readdirSync } from 'node:fs';
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import { describe, expect, it } from 'vitest';
import YAML from 'yaml';
import { compileCsfModule } from '.';
async function generate(filePath: string) {
const content = await readFile(filePath, {... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/server-webpack/src/lib/compiler/types.ts | code/presets/server-webpack/src/lib/compiler/types.ts | export interface CompileStorybookStoryArgs {
name: string;
[x: string]: any;
}
export interface CompileStorybookSectionArgs {
title: string;
stories: CompileStorybookStoryArgs[];
[x: string]: any;
}
export interface CompileCsfModuleArgs extends CompileStorybookSectionArgs {
addons?: string[];
}
export in... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/server-webpack/src/lib/compiler/index.ts | code/presets/server-webpack/src/lib/compiler/index.ts | import { stringifySection } from './stringifier';
import type { CompileCsfModuleArgs, CompileStorybookSectionArgs, StorybookSection } from './types';
function createSection(args: CompileStorybookSectionArgs): StorybookSection {
return {
imports: {},
decorators: [],
...args,
};
}
export function compil... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/react-webpack/build-config.ts | code/presets/react-webpack/build-config.ts | import type { BuildEntries } from '../../../scripts/build/utils/entry-utils';
const config: BuildEntries = {
entries: {
node: [
{
exportEntries: ['.'],
entryPoint: './src/index.ts',
},
{
exportEntries: ['./preset-cra'],
entryPoint: './src/framework-preset-cra.ts'... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/react-webpack/src/framework-preset-react-docs.ts | code/presets/react-webpack/src/framework-preset-react-docs.ts | import { fileURLToPath } from 'node:url';
import type { Configuration } from 'webpack';
import type { StorybookConfig } from './types';
export const webpackFinal: StorybookConfig['webpackFinal'] = async (
config,
options
): Promise<Configuration> => {
const typescriptOptions = await options.presets.apply('type... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/react-webpack/src/framework-preset-react-docs.test.ts | code/presets/react-webpack/src/framework-preset-react-docs.test.ts | import { describe, expect, it, vi } from 'vitest';
import type { TypescriptOptions } from '@storybook/core-webpack';
import ReactDocgenTypescriptPlugin from '@storybook/react-docgen-typescript-plugin';
import type { Configuration } from 'webpack';
import * as preset from './framework-preset-react-docs';
vi.mock('./... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/react-webpack/src/cra-config.test.ts | code/presets/react-webpack/src/cra-config.test.ts | import fs from 'node:fs';
import { join, sep } from 'node:path';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { getReactScriptsPath } from './cra-config';
vi.mock('fs', () => ({
realpathSync: vi.fn(() => '/test-project'),
readFileSync: vi.fn(),
existsSync: vi.fn(() => true),
}));
cons... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/react-webpack/src/cra-config.ts | code/presets/react-webpack/src/cra-config.ts | import { existsSync, readFileSync, realpathSync } from 'node:fs';
import { join } from 'node:path';
import { pathToFileURL } from 'node:url';
import { logger } from 'storybook/internal/node-logger';
import semver from 'semver';
const appDirectory = realpathSync(process.cwd());
let reactScriptsPath: string;
export ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/react-webpack/src/types.ts | code/presets/react-webpack/src/types.ts | import type {
StorybookConfig as StorybookConfigBase,
TypescriptOptions as TypescriptOptionsBase,
WebpackConfiguration as WebpackConfigurationBase,
} from '@storybook/core-webpack';
import type { PluginOptions as ReactDocgenTypescriptOptions } from '@storybook/react-docgen-typescript-plugin';
export type { Build... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/react-webpack/src/index.ts | code/presets/react-webpack/src/index.ts | import { fileURLToPath } from 'node:url';
import type { PresetProperty } from 'storybook/internal/types';
export * from './types';
export const addons: PresetProperty<'addons'> = [
fileURLToPath(import.meta.resolve('@storybook/preset-react-webpack/preset-cra')),
fileURLToPath(import.meta.resolve('@storybook/pres... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/react-webpack/src/framework-preset-cra.ts | code/presets/react-webpack/src/framework-preset-cra.ts | import { logger } from 'storybook/internal/node-logger';
import type { Preset, StorybookConfig } from '@storybook/core-webpack';
import { isReactScriptsInstalled } from './cra-config';
const checkForNewPreset = (presetsList: Preset[]) => {
const hasNewPreset = presetsList.some((preset: Preset) => {
const prese... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/react-webpack/src/loaders/react-docgen-loader.test.ts | code/presets/react-webpack/src/loaders/react-docgen-loader.test.ts | import { describe, expect, it, vi } from 'vitest';
import { getReactDocgenImporter } from './react-docgen-loader';
const reactDocgenMock = vi.hoisted(() => {
return {
makeFsImporter: vi.fn().mockImplementation((fn) => fn),
};
});
const reactDocgenResolverMock = vi.hoisted(() => {
return {
defaultLookup... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/react-webpack/src/loaders/react-docgen-loader.ts | code/presets/react-webpack/src/loaders/react-docgen-loader.ts | import { getProjectRoot } from 'storybook/internal/common';
import { logger } from 'storybook/internal/node-logger';
import * as find from 'empathic/find';
import MagicString from 'magic-string';
import {
ERROR_CODES,
builtinHandlers as docgenHandlers,
builtinResolvers as docgenResolver,
makeFsImporter,
pars... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/presets/react-webpack/src/loaders/docgen-resolver.ts | code/presets/react-webpack/src/loaders/docgen-resolver.ts | import { extname } from 'node:path';
import resolve from 'resolve';
export class ReactDocgenResolveError extends Error {
// the magic string that react-docgen uses to check if a module is ignored
readonly code = 'MODULE_NOT_FOUND';
constructor(filename: string) {
super(`'${filename}' was ignored by react-d... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/__mocks__/fs-extra.ts | code/__mocks__/fs-extra.ts | import { vi } from 'vitest';
// This is a custom function that our tests can use during setup to specify
// what the files on the "mock" filesystem should look like when any of the
// `fs` APIs are used.
let mockFiles = Object.create(null);
export function __setMockFiles(newMockFiles: Record<string, string | null>) {... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/__mocks__/fs.ts | code/__mocks__/fs.ts | import { vi } from 'vitest';
// This is a custom function that our tests can use during setup to specify
// what the files on the "mock" filesystem should look like when any of the
// `fs` APIs are used.
let mockFiles = Object.create(null);
export function __setMockFiles(newMockFiles: Record<string, string | null>) {... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/__mocks__/fs/promises.ts | code/__mocks__/fs/promises.ts | import { vi } from 'vitest';
// This is a custom function that our tests can use during setup to specify
// what the files on the "mock" filesystem should look like when any of the
// `fs` APIs are used.
let mockFiles = Object.create(null);
export function __setMockFiles(newMockFiles: Record<string, string | null>) {... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/vitest.workspace.ts | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/vitest.workspace.ts | import { defineWorkspace } from "vitest/config";
import { storybookTest } from "@storybook/addon-vitest/vitest-plugin";
export default defineWorkspace([
{
extends: "vite.config.ts",
plugins: [
storybookTest(
process.env.SKIP_FAIL_ON_PURPOSE
? {
tags: {
ex... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/playwright-e2e.config.ts | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/playwright-e2e.config.ts | import { defineConfig, devices } from "@playwright/test";
import path from "node:path";
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./e2e-tests",
outputDir: "./test-results",
/* Maximum time one test can run for. */
timeout: (process.env.CI ? 60 : 30) ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/vite.config.ts | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/vite.config.ts | import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
});
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/.storybook/aliased.ts | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/.storybook/aliased.ts | // This file is used to test that viteFinal is correctly loaded in Vitest
// main.ts defines this file as a resolve alias, which is used in the ViteFinalTest story
export const aliasedFunction = () => true;
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/.storybook/preview.tsx | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/.storybook/preview.tsx | import type { Preview } from '@storybook/react-vite';
import { getDecoratorString } from './get-decorator-string';
console.log('preview file is called!');
const preview: Preview = {
decorators: [
(StoryFn) => (
<div data-testid="global-decorator">
<div data-testid="decorator-string">{getDecoratorS... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/.storybook/vitest.setup.ts | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/.storybook/vitest.setup.ts | import { setProjectAnnotations } from "@storybook/react-vite";
import * as addonA11yAnnotations from "@storybook/addon-a11y/preview";
import * as projectAnnotations from "./preview";
import { getString } from "./setup-file-dependency";
setProjectAnnotations([addonA11yAnnotations, projectAnnotations]);
console.log(get... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/.storybook/setup-file-dependency.ts | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/.storybook/setup-file-dependency.ts | export const getString = () => {
return "initial string";
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/.storybook/main.ts | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/.storybook/main.ts | import { join } from "node:path";
import type { StorybookConfig } from "@storybook/react-vite";
const config: StorybookConfig = {
stories: ["../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: ["@storybook/addon-vitest", "@storybook/addon-a11y"],
framework: {
name: "@storybook/react-vite",
options: ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/.storybook/get-decorator-string.ts | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/.storybook/get-decorator-string.ts | export const getDecoratorString = () => {
return "Global Decorator";
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/UnhandledErrors.stories.tsx | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/UnhandledErrors.stories.tsx | import type { Meta, StoryObj } from '@storybook/react-vite';
async function unhandledRejection() {
throwError('I THREW AN UNHANDLED REJECTION!');
}
function unhandledError() {
throwError('I THREW AN UNHANDLED ERROR!');
}
function throwError(message: string) {
throw new Error(message);
}
const meta = {
title:... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/MyButton.stories.tsx | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/MyButton.stories.tsx | import type { Meta, StoryObj as CSF3Story } from '@storybook/react-vite';
import type { ButtonProps } from './Button';
import { Button } from './Button';
const meta = {
title: 'Example/MyButton',
component: Button,
tags: ['!test'],
argTypes: {
backgroundColor: { control: 'color' },
},
} satisfies Meta<t... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/AddonTest.tsx | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/AddonTest.tsx | import { getButtonString } from './get-button-string';
export const Component = () => {
return <button>{getButtonString()}</button>;
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/AddonTest.stories.tsx | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/AddonTest.stories.tsx | import { expect, within } from 'storybook/test';
import { Meta, type StoryObj } from '@storybook/react-vite';
import { instrument } from 'storybook/internal/instrumenter';
import { Component } from './AddonTest';
declare global {
// eslint-disable-next-line no-var
var __vitest_browser__: boolean;
}
const meta = {... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/Button.stories.tsx | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/Button.stories.tsx | import { expect, fn } from 'storybook/test';
import type { Meta, StoryFn as CSF2Story, StoryObj as CSF3Story } from '@storybook/react-vite';
import type { ButtonProps } from './Button';
import { Button } from './Button';
const meta = {
title: 'Example/Button',
component: Button,
argTypes: {
backgroundColor:... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/Button.tsx | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/Button.tsx | import React from 'react';
import './button.css';
export interface ButtonProps {
/**
* Is this the principal call to action on the page?
*/
primary?: boolean;
/**
* What background color to use
*/
backgroundColor?: string;
/**
* How large should the button be?
*/
size?: 'small' | 'medium'... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/OtherComponent.stories.tsx | test-storybooks/portable-stories-kitchen-sink/react-vitest-3/stories/OtherComponent.stories.tsx | import { Meta, type StoryObj } from '@storybook/react-vite';
const Component = () => <button>test</button>
const meta = {
title: 'Addons/Group/Other',
component: Component,
} as Meta<typeof Component>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Passes: Story = {
};
export const Fail... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.