level_0 int64 0 10k | index int64 0 0 | repo_id stringlengths 22 152 | file_path stringlengths 41 203 | content stringlengths 11 11.5M |
|---|---|---|---|---|
199 | 0 | petrpan-code/storybookjs/storybook/code/frameworks/nextjs/src/font | petrpan-code/storybookjs/storybook/code/frameworks/nextjs/src/font/babel/index.test.ts | /* eslint-disable @typescript-eslint/no-non-null-assertion */
import { transform } from '@babel/core';
import TransformFontImports from '.';
const example = `
import { Inter, Lora as FontLora, Roboto } from 'next/font/google'
import localFont from 'next/font/local'
const myFont = localFont({ src: './my-font.woff2' })... |
443 | 0 | petrpan-code/storybookjs/storybook/code/lib/channels | petrpan-code/storybookjs/storybook/code/lib/channels/src/index.test.ts | import type { ChannelTransport, Listener } from '.';
import { Channel } from '.';
jest.useFakeTimers();
describe('Channel', () => {
let transport: ChannelTransport;
let channel: Channel;
beforeEach(() => {
transport = { setHandler: jest.fn(), send: jest.fn() };
channel = new Channel({ transport });
}... |
485 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli | petrpan-code/storybookjs/storybook/code/lib/cli/src/detect.test.ts | import * as fs from 'fs';
import { logger } from '@storybook/node-logger';
import { detect, detectFrameworkPreset, detectLanguage } from './detect';
import { ProjectType, SupportedLanguage } from './project_types';
import type { JsPackageManager, PackageJsonWithMaybeDeps } from './js-package-manager';
jest.mock('./hel... |
491 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli | petrpan-code/storybookjs/storybook/code/lib/cli/src/helpers.test.ts | import fs from 'fs';
import fse from 'fs-extra';
import * as helpers from './helpers';
import type { JsPackageManager } from './js-package-manager';
import type { SupportedRenderers } from './project_types';
import { SupportedLanguage } from './project_types';
jest.mock('fs', () => ({
existsSync: jest.fn(),
}));
je... |
497 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli | petrpan-code/storybookjs/storybook/code/lib/cli/src/project_types.test.ts | import { installableProjectTypes, SUPPORTED_RENDERERS } from './project_types';
describe('installableProjectTypes should have an entry for the supported framework', () => {
SUPPORTED_RENDERERS.forEach((framework) => {
it(`${framework}`, () => {
expect(installableProjectTypes.includes(framework.replace(/-/g... |
502 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli | petrpan-code/storybookjs/storybook/code/lib/cli/src/upgrade.test.ts | import { addExtraFlags, addNxPackagesToReject, getStorybookVersion } from './upgrade';
describe.each([
['β β β βββ @babel/code-frame@7.10.3 deduped', null],
[
'β βββ @storybook/theming@6.0.0-beta.37 extraneous',
{ package: '@storybook/theming', version: '6.0.0-beta.37' },
],
[
'βββ¬ @storybook/prese... |
504 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli | petrpan-code/storybookjs/storybook/code/lib/cli/src/utils.test.ts | import { isCorePackage } from './utils';
describe('UTILS', () => {
describe.each([
['@storybook/react', true],
['@storybook/node-logger', true],
['@storybook/addon-info', true],
['@storybook/something-random', true],
['@storybook/preset-create-react-app', false],
['@storybook/linter-config', ... |
507 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli | petrpan-code/storybookjs/storybook/code/lib/cli/src/warn.test.ts | import globby from 'globby';
import { logger } from '@storybook/node-logger';
import { warn } from './warn';
jest.mock('@storybook/node-logger');
jest.mock('globby');
describe('warn', () => {
beforeEach(() => {
jest.clearAllMocks();
});
describe('when TypeScript is installed as a dependency', () => {
i... |
512 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/add-react.test.ts | import type { StorybookConfig } from '@storybook/types';
import type { JsPackageManager, PackageJson } from '../../js-package-manager';
import { addReact } from './add-react';
const checkAddReact = async (packageJson: PackageJson) => {
const packageManager = {
retrievePackageJson: async () => ({ dependencies: {}... |
514 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/angular-builders-multiproject.test.ts | import type { StorybookConfig } from '@storybook/types';
import type { JsPackageManager } from '../../js-package-manager';
import { angularBuildersMultiproject } from './angular-builders-multiproject';
import * as helpers from '../../helpers';
import * as angularHelpers from '../../generators/ANGULAR/helpers';
const c... |
516 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/angular-builders.test.ts | import type { StorybookConfig } from '@storybook/types';
import { angularBuilders } from './angular-builders';
import * as helpers from '../../helpers';
import * as angularHelpers from '../../generators/ANGULAR/helpers';
import type { JsPackageManager } from '../../js-package-manager';
const checkAngularBuilders = asy... |
518 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/autodocs-true.test.ts | import type { StorybookConfig } from '@storybook/types';
import type { PackageJson } from '../../js-package-manager';
import { makePackageManager } from '../helpers/testing-helpers';
import { autodocsTrue } from './autodocs-true';
const checkAutodocs = async ({
packageJson = {},
main: mainConfig,
}: {
packageJso... |
520 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/bare-mdx-stories-glob.test.ts | /// <reference types="@types/jest" />;
import type { StorybookConfig } from '@storybook/types';
import type { PackageJson } from '../../js-package-manager';
import { ansiRegex } from '../helpers/cleanLog';
import { makePackageManager } from '../helpers/testing-helpers';
import type { BareMdxStoriesGlobRunOptions } fro... |
522 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/builder-vite.test.ts | import type { StorybookConfig } from '@storybook/types';
import { makePackageManager } from '../helpers/testing-helpers';
import type { PackageJson } from '../../js-package-manager';
import { builderVite } from './builder-vite';
const checkBuilderVite = async ({
packageJson = {},
main: mainConfig,
}: {
packageJs... |
524 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/cra5.test.ts | import type { StorybookConfig } from '@storybook/types';
import type { JsPackageManager } from '../../js-package-manager';
import { cra5 } from './cra5';
const checkCra5 = async ({
packageManager,
main: mainConfig,
storybookVersion = '7.0.0',
}: {
packageManager: any;
main?: Partial<StorybookConfig> & Record... |
526 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/eslint-plugin.test.ts | /* eslint-disable no-underscore-dangle */
import { dedent } from 'ts-dedent';
import type { PackageJson } from '../../js-package-manager';
import { eslintPlugin } from './eslint-plugin';
import { makePackageManager } from '../helpers/testing-helpers';
// eslint-disable-next-line global-require, jest/no-mocks-import
je... |
528 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/incompatible-addons.test.ts | /// <reference types="@types/jest" />;
import type { StorybookConfig } from '@storybook/types';
import { incompatibleAddons } from './incompatible-addons';
import type { JsPackageManager } from '../../js-package-manager';
const check = async ({
packageManager,
main: mainConfig = {},
storybookVersion = '7.0.0',
... |
531 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/mdx-1-to-2.test.ts | /// <reference types="@types/jest" />;
import { dedent } from 'ts-dedent';
import { fixMdxStyleTags, fixMdxComments } from './mdx-1-to-2';
it('fixMdxStyleTags fixes badly-formatted style blocks', () => {
expect(
fixMdxStyleTags(dedent`
<style>{\`
.foo {}
.bar {}
\`}<... |
533 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/mdx-gfm.test.ts | import type { StorybookConfig } from '@storybook/types';
import { mdxgfm } from './mdx-gfm';
jest.mock('globby', () => ({
__esModule: true,
default: jest.fn().mockResolvedValue(['a/fake/file.mdx']),
}));
const check = async ({
packageManager,
main: mainConfig,
storybookVersion = '7.0.0',
}: {
packageManag... |
535 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/missing-babelrc.test.ts | /* eslint-disable no-underscore-dangle */
/// <reference types="@types/jest" />;
import type { StorybookConfig } from '@storybook/types';
import { missingBabelRc } from './missing-babelrc';
import type { JsPackageManager } from '../../js-package-manager';
// eslint-disable-next-line global-require, jest/no-mocks-impo... |
537 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/new-frameworks.test.ts | import type { StorybookConfig } from '@storybook/types';
import * as findUp from 'find-up';
import * as rendererHelpers from '../helpers/detectRenderer';
import { newFrameworks } from './new-frameworks';
import type { JsPackageManager } from '../../js-package-manager';
jest.mock('find-up');
jest.mock('../helpers/detec... |
539 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/nodejs-requirement.test.ts | /// <reference types="@types/jest" />;
import { nodeJsRequirement } from './nodejs-requirement';
// eslint-disable-next-line global-require, jest/no-mocks-import
jest.mock('fs-extra', () => require('../../../../../__mocks__/fs-extra'));
const check = async ({ storybookVersion = '7.0.0' }) => {
return nodeJsRequire... |
541 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/remove-global-client-apis.test.ts | /// <reference types="@types/jest" />;
/* eslint-disable no-underscore-dangle */
import path from 'path';
import type { JsPackageManager } from '../../js-package-manager';
import { RemovedAPIs, removedGlobalClientAPIs as migration } from './remove-global-client-apis';
// eslint-disable-next-line global-require, jest/... |
543 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/sb-binary.test.ts | import type { JsPackageManager } from '../../js-package-manager';
import { sbBinary } from './sb-binary';
const checkStorybookBinary = async ({
packageManager,
storybookVersion = '7.0.0',
}: {
packageManager: Partial<JsPackageManager>;
storybookVersion?: string;
}) => {
return sbBinary.check({
packageMan... |
545 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/sb-scripts.test.ts | import type { JsPackageManager } from '../../js-package-manager';
import { getStorybookScripts, sbScripts } from './sb-scripts';
const checkSbScripts = async ({
packageManager,
storybookVersion = '7.0.0',
}: {
packageManager: Partial<JsPackageManager>;
storybookVersion?: string;
}) => {
return sbScripts.chec... |
547 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/vue3.test.ts | import type { StorybookConfig } from '@storybook/types';
import type { JsPackageManager } from '../../js-package-manager';
import { vue3 } from './vue3';
const checkVue3 = async ({
main: mainConfig = {},
storybookVersion = '7.0.0',
packageManager,
}: {
main?: Partial<StorybookConfig> & Record<string, unknown>;... |
549 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/webpack5.test.ts | import type { StorybookConfig } from '@storybook/types';
import type { JsPackageManager } from '../../js-package-manager';
import { webpack5 } from './webpack5';
const checkWebpack5 = async ({
packageManager,
main: mainConfig,
storybookVersion = '6.3.0',
}: {
packageManager: Partial<JsPackageManager>;
main?:... |
552 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/wrap-require.test.ts | import { wrapRequire } from './wrap-require';
import * as detect from '../../detect';
jest.mock('../../detect', () => ({
...jest.requireActual('../../detect'),
detectPnp: jest.fn(),
}));
describe('wrapRequire', () => {
describe('check', () => {
it('should return null if not in a monorepo and pnp is not enab... |
554 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/fixes/__snapshots__/angular-builders.test.ts.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`is not Nx project angular builders Angular < 14.0.0 should throw an Error 1`] = `
"β Your project uses Angular < 14.0.0. Storybook 7.0 for Angular requires Angular 14.0.0 or higher.
Please upgrade your Angular version to at least version 14.0.0 to use Storybook 7.0 ... |
557 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/helpers/checkWebpack5Builder.test.ts | import type { StorybookConfig } from '@storybook/types';
import { checkWebpack5Builder } from './checkWebpack5Builder';
import { getBuilderPackageName } from './mainConfigFile';
const mockMainConfig: StorybookConfig = {
framework: 'react',
addons: [],
stories: [],
};
jest.mock('./mainConfigFile');
describe('ch... |
562 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/helpers/getMigrationSummary.test.ts | import { getMigrationSummary } from './getMigrationSummary';
import { FixStatus } from '../types';
import type { InstallationMetadata } from '../../js-package-manager/types';
jest.mock('boxen', () =>
// eslint-disable-next-line no-control-regex
jest.fn((str, { title = '' }) => `${title}\n\n${str.replace(/\x1b\[[0-... |
564 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/helpers/mainConfigFile.test.ts | import {
getBuilderPackageName,
getFrameworkPackageName,
getRendererPackageNameFromFramework,
} from './mainConfigFile';
describe('getBuilderPackageName', () => {
it('should return null when mainConfig is undefined or null', () => {
const packageName = getBuilderPackageName(undefined);
expect(packageNa... |
566 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate | petrpan-code/storybookjs/storybook/code/lib/cli/src/automigrate/helpers/new-frameworks-utils.test.ts | import * as findUp from 'find-up';
import {
detectBuilderInfo as _getBuilderInfo,
getNextjsAddonOptions,
} from './new-frameworks-utils';
import type { JsPackageManager } from '../../js-package-manager';
jest.mock('find-up');
type GetBuilderInfoParams = Parameters<typeof _getBuilderInfo>[0]['mainConfig'];
const ... |
575 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src | petrpan-code/storybookjs/storybook/code/lib/cli/src/generators/configure.test.ts | import fse from 'fs-extra';
import dedent from 'ts-dedent';
import { SupportedLanguage } from '../project_types';
import { configureMain, configurePreview } from './configure';
jest.mock('fs-extra');
describe('configureMain', () => {
beforeAll(() => {
jest.clearAllMocks();
});
test('should generate main.js... |
598 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src | petrpan-code/storybookjs/storybook/code/lib/cli/src/js-package-manager/JsPackageManagerFactory.test.ts | import { sync as spawnSync } from 'cross-spawn';
import { sync as findUpSync } from 'find-up';
import path from 'path';
import { JsPackageManagerFactory } from './JsPackageManagerFactory';
import { NPMProxy } from './NPMProxy';
import { PNPMProxy } from './PNPMProxy';
import { Yarn1Proxy } from './Yarn1Proxy';
import {... |
600 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src | petrpan-code/storybookjs/storybook/code/lib/cli/src/js-package-manager/NPMProxy.test.ts | import { NPMProxy } from './NPMProxy';
// mock createLogStream
jest.mock('../utils', () => ({
createLogStream: jest.fn(() => ({
logStream: '',
readLogFile: jest.fn(),
moveLogFile: jest.fn(),
removeLogFile: jest.fn(),
})),
}));
describe('NPM Proxy', () => {
let npmProxy: NPMProxy;
beforeEach((... |
602 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src | petrpan-code/storybookjs/storybook/code/lib/cli/src/js-package-manager/PNPMProxy.test.ts | import { PNPMProxy } from './PNPMProxy';
describe('PNPM Proxy', () => {
let pnpmProxy: PNPMProxy;
beforeEach(() => {
pnpmProxy = new PNPMProxy();
});
it('type should be pnpm', () => {
expect(pnpmProxy.type).toEqual('pnpm');
});
describe('initPackageJson', () => {
it('should run `pnpm init`',... |
605 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src | petrpan-code/storybookjs/storybook/code/lib/cli/src/js-package-manager/Yarn1Proxy.test.ts | import dedent from 'ts-dedent';
import { Yarn1Proxy } from './Yarn1Proxy';
describe('Yarn 1 Proxy', () => {
let yarn1Proxy: Yarn1Proxy;
beforeEach(() => {
yarn1Proxy = new Yarn1Proxy();
});
it('type should be yarn1', () => {
expect(yarn1Proxy.type).toEqual('yarn1');
});
describe('initPackageJson... |
607 | 0 | petrpan-code/storybookjs/storybook/code/lib/cli/src | petrpan-code/storybookjs/storybook/code/lib/cli/src/js-package-manager/Yarn2Proxy.test.ts | import dedent from 'ts-dedent';
import { Yarn2Proxy } from './Yarn2Proxy';
describe('Yarn 2 Proxy', () => {
let yarn2Proxy: Yarn2Proxy;
beforeEach(() => {
yarn2Proxy = new Yarn2Proxy();
});
it('type should be yarn2', () => {
expect(yarn2Proxy.type).toEqual('yarn2');
});
describe('initPackageJson... |
631 | 0 | petrpan-code/storybookjs/storybook/code/lib/client-logger | petrpan-code/storybookjs/storybook/code/lib/client-logger/src/index.test.ts | import { logger } from '.';
jest.mock('@storybook/global', () => ({ global: { ...global, LOGLEVEL: 'debug' } }));
describe('client-logger default LOGLEVEL', () => {
const initialConsole = { ...global.console };
beforeEach(() => {
global.console.trace = jest.fn();
global.console.debug = jest.fn();
glob... |
727 | 0 | petrpan-code/storybookjs/storybook/code/lib/codemod/src/transforms | petrpan-code/storybookjs/storybook/code/lib/codemod/src/transforms/__tests__/csf-2-to-3.test.ts | import { describe, it, expect } from '@jest/globals';
import { dedent } from 'ts-dedent';
import type { API } from 'jscodeshift';
import ansiRegex from 'ansi-regex';
import _transform from '../csf-2-to-3';
expect.addSnapshotSerializer({
print: (val: any) => val,
test: () => true,
});
const jsTransform = (source: ... |
728 | 0 | petrpan-code/storybookjs/storybook/code/lib/codemod/src/transforms | petrpan-code/storybookjs/storybook/code/lib/codemod/src/transforms/__tests__/mdx-to-csf.test.ts | import * as fs_ from 'node:fs';
import { expect, test } from '@jest/globals';
import dedent from 'ts-dedent';
import jscodeshift, { nameToValidExport } from '../mdx-to-csf';
expect.addSnapshotSerializer({
print: (val: any) => (typeof val === 'string' ? val : JSON.stringify(val, null, 2) ?? ''),
test: () => true,
}... |
730 | 0 | petrpan-code/storybookjs/storybook/code/lib/codemod/src/transforms | petrpan-code/storybookjs/storybook/code/lib/codemod/src/transforms/__tests__/upgrade-deprecated-types.test.ts | import { describe, expect, it } from '@jest/globals';
import { dedent } from 'ts-dedent';
import type { API } from 'jscodeshift';
import ansiRegex from 'ansi-regex';
import _transform from '../upgrade-deprecated-types';
expect.addSnapshotSerializer({
print: (val: any) => val,
test: () => true,
});
const tsTransfo... |
736 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-common | petrpan-code/storybookjs/storybook/code/lib/core-common/src/config.test.ts | import { filterPresetsConfig } from './presets';
describe('filterPresetsConfig', () => {
it('string config', () => {
expect(filterPresetsConfig(['@storybook/preset-scss', '@storybook/preset-typescript'])).toEqual(
['@storybook/preset-scss']
);
});
it('windows paths', () => {
expect(filterPrese... |
738 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-common | petrpan-code/storybookjs/storybook/code/lib/core-common/src/presets.test.ts | import path from 'path';
import { logger } from '@storybook/node-logger';
import './presets';
function wrapPreset(basePresets: any): { babel: Function; webpack: Function } {
return {
babel: async (config: any, args: any) => basePresets.apply('babel', config, args),
webpack: async (config: any, args: any) => ... |
751 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-common/src | petrpan-code/storybookjs/storybook/code/lib/core-common/src/utils/get-storybook-configuration.test.ts | import { getStorybookConfiguration } from './get-storybook-configuration';
describe('getStorybookConfiguration', () => {
it('handles short names', () => {
const port = getStorybookConfiguration('start-storybook -p 9001', '-p', '--port');
expect(port).toBe('9001');
});
it('handles long names', () => {
... |
776 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-common/src | petrpan-code/storybookjs/storybook/code/lib/core-common/src/utils/validate-config.test.ts | import { validateFrameworkName } from './validate-config';
describe('validateFrameworkName', () => {
afterEach(jest.resetAllMocks);
it('should throw if name is undefined', () => {
expect(() => validateFrameworkName(undefined)).toThrow();
});
it('should throw if name is a renderer', () => {
expect(() =... |
779 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-common/src/utils | petrpan-code/storybookjs/storybook/code/lib/core-common/src/utils/__tests__/check-addon-order.test.ts | import { logger } from '@storybook/node-logger';
import type {
CoreCommon_AddonEntry,
CoreCommon_AddonInfo,
CoreCommon_OptionsEntry,
} from '@storybook/types';
import { checkAddonOrder } from '../check-addon-order';
const configFile = './main.js';
const essentialAddons = [
'docs',
'controls',
'actions',
... |
780 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-common/src/utils | petrpan-code/storybookjs/storybook/code/lib/core-common/src/utils/__tests__/interpret-files.test.ts | import mock from 'mock-fs';
import { getInterpretedFile } from '../interpret-files';
describe('interpret-files', () => {
it('will interpret file as file.ts when it exists in fs', () => {
mock({
'path/to/file.ts': 'ts file contents',
});
const file = getInterpretedFile('path/to/file');
expect(... |
781 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-common/src/utils | petrpan-code/storybookjs/storybook/code/lib/core-common/src/utils/__tests__/normalize-stories.test.ts | // eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../../test-typings.d.ts" />
import { dedent } from 'ts-dedent';
import { sep } from 'path';
import { InvalidStoriesEntryError } from '@storybook/core-events/server-errors';
import {
getDirectoryFromWorkingDir,
normalizeStor... |
782 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-common/src/utils | petrpan-code/storybookjs/storybook/code/lib/core-common/src/utils/__tests__/paths.test.ts | import path from 'path';
import findUp from 'find-up';
import slash from 'slash';
import { normalizeStoryPath, getProjectRoot } from '../paths';
jest.mock('find-up');
describe('paths - normalizeStoryPath()', () => {
it('returns a path starting with "./" unchanged', () => {
const filename = `.${path.sep}${path.j... |
783 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-common/src/utils | petrpan-code/storybookjs/storybook/code/lib/core-common/src/utils/__tests__/template.test.ts | import mock from 'mock-fs';
import { getPreviewHeadTemplate, getPreviewBodyTemplate } from '../template';
const HEAD_HTML_CONTENTS = '<script>console.log("custom script!");</script>';
const BASE_HTML_CONTENTS = '<script>console.log("base script!");</script>';
const BASE_BODY_HTML_CONTENTS = '<div>story contents</div>... |
793 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-events | petrpan-code/storybookjs/storybook/code/lib/core-events/src/index.test.ts | import * as EventsPackageExport from './index';
import EventsDefaultExport, { CHANNEL_CREATED } from './index';
describe('Core Events', () => {
it('Should export the module as a namespace', () => {
expect(EventsPackageExport.CHANNEL_CREATED).toBe('channelCreated');
});
it('Should export all values in the def... |
798 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-events/src | petrpan-code/storybookjs/storybook/code/lib/core-events/src/errors/server-errors.test.ts | /* eslint-disable local-rules/no-uncategorized-errors */
import { WebpackCompilationError } from './server-errors';
describe('WebpackCompilationError', () => {
it('should correctly handle error with stats.compilation.errors', () => {
const errors = [
new Error('Error 1 \u001B[4mmessage\u001B[0m'),
ne... |
800 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-events/src | petrpan-code/storybookjs/storybook/code/lib/core-events/src/errors/storybook-error.test.ts | import { StorybookError } from './storybook-error';
describe('StorybookError', () => {
class TestError extends StorybookError {
category = 'TEST_CATEGORY';
code = 123;
template() {
return 'This is a test error.';
}
}
it('should generate the correct error name', () => {
const error = ... |
815 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server | petrpan-code/storybookjs/storybook/code/lib/core-server/src/withTelemetry.test.ts | /* eslint-disable local-rules/no-uncategorized-errors */
/// <reference types="@types/jest" />;
import prompts from 'prompts';
import { loadAllPresets, cache } from '@storybook/core-common';
import { telemetry, oneWayHash } from '@storybook/telemetry';
import { getErrorLevel, sendTelemetryError, withTelemetry } from ... |
829 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src | petrpan-code/storybookjs/storybook/code/lib/core-server/src/presets/favicon.test.ts | /// <reference types="@types/jest" />;
import { join } from 'path';
import * as fs from 'fs-extra';
import { logger } from '@storybook/node-logger';
import * as m from './common-preset';
const defaultFavicon = require.resolve('@storybook/core-server/public/favicon.svg');
const createPath = (...p: string[]) => join(p... |
831 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/StoryIndexGenerator.deprecated.test.ts | /* eslint-disable @typescript-eslint/no-shadow */
/// <reference types="@types/jest" />;
/**
* @jest-environment node
*/
import path from 'path';
import fs from 'fs-extra';
import { normalizeStoriesEntry } from '@storybook/core-common';
import type { NormalizedStoriesSpecifier, StoryIndexEntry } from '@storybook/ty... |
832 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/StoryIndexGenerator.test.ts | /* eslint-disable @typescript-eslint/no-shadow */
/// <reference types="@types/jest" />;
/**
* @jest-environment node
*/
import path from 'path';
// @ts-expect-error -- cannot find declaration file
import { createStoriesMdxIndexer } from '@storybook/addon-docs/preset';
import { normalizeStoriesEntry } from '@storyb... |
851 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/server-address.test.ts | import detectPort from 'detect-port';
import { getServerAddresses, getServerPort, getServerChannelUrl } from './server-address';
jest.mock('ip');
jest.mock('detect-port');
jest.mock('@storybook/node-logger');
describe('getServerAddresses', () => {
const port = 3000;
const host = 'localhost';
const proto = 'http... |
855 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/stories-json.test.ts | /// <reference types="@types/jest" />;
import type { Router, Request, Response } from 'express';
import Watchpack from 'watchpack';
import path from 'path';
import debounce from 'lodash/debounce.js';
// @ts-expect-error -- cannot find declaration file
import { createStoriesMdxIndexer } from '@storybook/addon-docs/pres... |
857 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/summarizeIndex.test.ts | import { isPageStory, summarizeIndex } from './summarizeIndex';
describe('isPageStory', () => {
describe('true positives', () => {
it.each(['pages/login', 'screens/login', 'components/LoginPage', 'components/LoginScreen'])(
'%s',
(title) => {
expect(isPageStory(title)).toBe(true);
}
... |
862 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/watch-story-specifiers.test.ts | import { normalizeStoriesEntry } from '@storybook/core-common';
import path from 'path';
import Watchpack from 'watchpack';
import { watchStorySpecifiers } from './watch-story-specifiers';
jest.mock('watchpack');
describe('watchStorySpecifiers', () => {
const workingDir = path.join(__dirname, '__mockdata__');
co... |
902 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/__tests__/IndexingError.test.ts | import { IndexingError, MultipleIndexingError } from '../IndexingError';
it('formats single file errors', () => {
const error = new IndexingError('parse error', ['./stories/File.stories.ts']);
expect(error.toString()).toMatchInlineSnapshot(`"./stories/File.stories.ts: parse error"`);
});
it('formats multi file e... |
903 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/__tests__/autoName.test.ts | import { autoName } from '../autoName';
it('pulls name from named MDX files', () => {
expect(autoName('Conventions.mdx', 'Button.stories.mdx', 'Docs')).toEqual('Conventions');
});
it('falls back for default named MDX files', () => {
expect(autoName('Button.mdx', 'Button.stories.mdx', 'Docs')).toEqual('Docs');
});... |
904 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/__tests__/index-extraction.test.ts | /// <reference types="@types/jest" />;
/**
* @jest-environment node
*/
import path from 'path';
import { normalizeStoriesEntry } from '@storybook/core-common';
import type { NormalizedStoriesSpecifier } from '@storybook/types';
import type { StoryIndexGeneratorOptions } from '../StoryIndexGenerator';
import { AUTO... |
905 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/__tests__/remove-mdx-stories.test.ts | import { glob as globlOriginal } from 'glob';
import { type StoriesEntry } from '@storybook/types';
import { normalizeStoriesEntry } from '@storybook/core-common';
import { join } from 'path';
import slash from 'slash';
import { removeMDXEntries } from '../remove-mdx-entries';
const glob = globlOriginal as jest.Mocked... |
906 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/__tests__/server-address.test.ts | import ip from 'ip';
import { getServerAddresses } from '../server-address';
jest.mock('ip');
const mockedIp = ip as jest.Mocked<typeof ip>;
describe('getServerAddresses', () => {
beforeEach(() => {
mockedIp.address.mockReturnValue('192.168.0.5');
});
it('builds addresses with a specified host', () => {
... |
907 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/__tests__/server-channel.test.ts | import type { Server } from 'http';
import { Channel } from '@storybook/channels';
import { EventEmitter } from 'events';
import { stringify } from 'telejson';
import { getServerChannel, ServerChannelTransport } from '../get-server-channel';
describe('getServerChannel', () => {
test('should return a channel', () =>... |
908 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils | petrpan-code/storybookjs/storybook/code/lib/core-server/src/utils/__tests__/server-statics.test.ts | import fs from 'fs-extra';
import path from 'path';
import 'jest-os-detection';
import { parseStaticDir } from '../server-statics';
fs.pathExists = jest.fn().mockReturnValue(true);
describe('parseStaticDir', () => {
it('returns the static dir/path and default target', async () => {
await expect(parseStaticDir('... |
915 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-webpack | petrpan-code/storybookjs/storybook/code/lib/core-webpack/src/importPipeline.test.ts | import { importPipeline } from './importPipeline';
const createGate = (): [Promise<any | undefined>, (_?: any) => void] => {
let openGate = (_?: any) => {};
const gate = new Promise<any | undefined>((resolve) => {
openGate = resolve;
});
return [gate, openGate];
};
it('passes through to passed importFn on... |
919 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-webpack | petrpan-code/storybookjs/storybook/code/lib/core-webpack/src/merge-webpack-config.test.ts | import type { Configuration } from 'webpack';
import { mergeConfigs } from './merge-webpack-config';
const config: Configuration = {
devtool: 'source-map',
entry: {
bundle: 'index.js',
},
output: {
filename: '[name].js',
},
module: {
rules: [{ use: 'r1' }, { use: 'r2' }],
},
// @ts-expect-e... |
921 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-webpack | petrpan-code/storybookjs/storybook/code/lib/core-webpack/src/to-importFn.test.ts | import { normalizeStoriesEntry } from '@storybook/core-common';
import { webpackIncludeRegexp } from './to-importFn';
const testCases: [string, string[], string[]][] = [
[
'**/*.stories.tsx',
[
'/Users/user/code/.storybook/Icon.stories.tsx',
'/Users/user/code/.storybook/stories/Icon.stories.tsx'... |
923 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-webpack | petrpan-code/storybookjs/storybook/code/lib/core-webpack/src/to-require-context.test.ts | import path from 'path';
import { normalizeStoriesEntry } from '@storybook/core-common';
import { toRequireContext } from './to-require-context';
const testCases = [
{
glob: '**/*.stories.tsx',
recursive: true,
validPaths: [
'./Icon.stories.tsx',
'./src/Icon.stories.tsx',
'./src/compon... |
927 | 0 | petrpan-code/storybookjs/storybook/code/lib/core-webpack/src | petrpan-code/storybookjs/storybook/code/lib/core-webpack/src/__snapshots__/merge-webpack-config.test.ts.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`mergeConfigs merges partial custom config 1`] = `
Object {
"devtool": "source-map",
"entry": Object {
"bundle": "index.js",
},
"module": Object {
"rules": Array [
Object {
"use": "r1",
},
Object {
"use": "r2",
}... |
941 | 0 | petrpan-code/storybookjs/storybook/code/lib/csf-tools | petrpan-code/storybookjs/storybook/code/lib/csf-tools/src/ConfigFile.test.ts | /// <reference types="@types/jest" />;
import { dedent } from 'ts-dedent';
import { loadConfig, printConfig } from './ConfigFile';
import { babelPrint } from './babelParse';
expect.addSnapshotSerializer({
print: (val: any) => val,
test: (val) => true,
});
const getField = (path: string[], source: string) => {
... |
943 | 0 | petrpan-code/storybookjs/storybook/code/lib/csf-tools | petrpan-code/storybookjs/storybook/code/lib/csf-tools/src/CsfFile.test.ts | /// <reference types="@types/jest" />;
/* eslint-disable no-underscore-dangle */
import { dedent } from 'ts-dedent';
import yaml from 'js-yaml';
import { loadCsf } from './CsfFile';
expect.addSnapshotSerializer({
print: (val: any) => yaml.dump(val).trimEnd(),
test: (val) => typeof val !== 'string',
});
const mak... |
946 | 0 | petrpan-code/storybookjs/storybook/code/lib/csf-tools | petrpan-code/storybookjs/storybook/code/lib/csf-tools/src/enrichCsf.test.ts | /// <reference types="@types/jest" />;
/* eslint-disable no-underscore-dangle */
import { dedent } from 'ts-dedent';
import { formatCsf, loadCsf } from './CsfFile';
import type { EnrichCsfOptions } from './enrichCsf';
import { enrichCsf, extractSource } from './enrichCsf';
expect.addSnapshotSerializer({
print: (val... |
949 | 0 | petrpan-code/storybookjs/storybook/code/lib/csf-tools | petrpan-code/storybookjs/storybook/code/lib/csf-tools/src/getStorySortParameter.test.ts | import { dedent } from 'ts-dedent';
import { getStorySortParameter } from './getStorySortParameter';
describe('getStorySortParameter', () => {
describe('named exports', () => {
describe('supported', () => {
it('no parameters', () => {
expect(
getStorySortParameter(dedent`
export... |
960 | 0 | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src/argTypes/enhanceArgTypes.test.ts | import type { ArgTypes, StrictInputType } from '@storybook/types';
import { enhanceArgTypes } from './enhanceArgTypes';
expect.addSnapshotSerializer({
print: (val: any) => JSON.stringify(val, null, 2),
test: (val) => typeof val !== 'string',
});
const enhance = ({
argType,
arg,
extractedArgTypes,
isArgsSt... |
963 | 0 | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src/argTypes/jsdocParser.test.ts | import { parseJsDoc } from './jsdocParser';
describe('parseJsDoc', () => {
it('should set includesJsDoc to false when the value is null', () => {
const { includesJsDoc, description, extractedTags } = parseJsDoc(null);
expect(includesJsDoc).toBeFalsy();
expect(description).toBeUndefined();
expect(ext... |
967 | 0 | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src/argTypes/utils.test.ts | import { createSummaryValue } from './utils';
describe('createSummaryValue', () => {
it('creates an object with just summary if detail is not passed', () => {
const summary = 'boolean';
expect(createSummaryValue(summary)).toEqual({ summary });
});
it('creates an object with summary & detail if passed', ... |
969 | 0 | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src/argTypes | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src/argTypes/convert/convert.test.ts | import 'jest-specific-snapshot';
import mapValues from 'lodash/mapValues.js';
import { transformSync } from '@babel/core';
import requireFromString from 'require-from-string';
import fs from 'fs';
import { convert } from './index';
import { normalizeNewlines } from '../utils';
expect.addSnapshotSerializer({
print: ... |
1,000 | 0 | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src/argTypes | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src/argTypes/docgen/extractDocgenProps.test.ts | /* eslint-disable no-underscore-dangle */
import type { Component } from '../types';
import { extractComponentProps } from './extractDocgenProps';
const DOCGEN_SECTION = 'props';
const PROP_NAME = 'propName';
interface TypeSystemDef {
name: string;
typeProperty?: string;
}
const TypeSystems: TypeSystemDef[] = [... |
1,005 | 0 | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src/argTypes/docgen | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src/argTypes/docgen/flow/createPropDef.test.ts | import { createFlowPropDef } from './createPropDef';
import type { DocgenInfo } from '../types';
const PROP_NAME = 'propName';
function createDocgenInfo({ flowType, ...others }: Partial<DocgenInfo>): DocgenInfo {
return {
flowType,
required: false,
...others,
};
}
describe('type', () => {
['string'... |
1,009 | 0 | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src/argTypes/docgen | petrpan-code/storybookjs/storybook/code/lib/docs-tools/src/argTypes/docgen/typeScript/createPropDef.test.ts | import { createTsPropDef } from './createPropDef';
import type { DocgenInfo } from '../types';
const PROP_NAME = 'propName';
function createDocgenInfo({ tsType, ...others }: Partial<DocgenInfo>): DocgenInfo {
return {
tsType,
required: true,
...others,
};
}
describe('type', () => {
it("should remov... |
1,022 | 0 | petrpan-code/storybookjs/storybook/code/lib/instrumenter | petrpan-code/storybookjs/storybook/code/lib/instrumenter/src/instrumenter.test.ts | /// <reference types="@types/jest" />;
/* eslint-disable no-underscore-dangle */
import { addons, mockChannel } from '@storybook/preview-api';
import { logger } from '@storybook/client-logger';
import {
FORCE_REMOUNT,
SET_CURRENT_STORY,
STORY_RENDER_PHASE_CHANGED,
} from '@storybook/core-events';
import { global... |
1,042 | 0 | petrpan-code/storybookjs/storybook/code/lib/manager-api/src | petrpan-code/storybookjs/storybook/code/lib/manager-api/src/lib/stories.test.ts | import type { StoryIndexV2, StoryIndexV3 } from '@storybook/types';
import { transformStoryIndexV2toV3, transformStoryIndexV3toV4 } from './stories';
const baseV2: StoryIndexV2['stories'][0] = {
id: '1',
story: '',
kind: '',
parameters: {},
};
const baseV3: StoryIndexV3['stories'][0] = {
id: '1',
title: '... |
1,060 | 0 | petrpan-code/storybookjs/storybook/code/lib/manager-api/src | petrpan-code/storybookjs/storybook/code/lib/manager-api/src/tests/events.test.ts | import { getEventMetadata } from '../lib/events';
import type { API } from '../index';
jest.mock('@storybook/global', () => ({
global: {
location: { origin: 'http://localhost:6006', pathname: '/' },
},
}));
describe('getEventMetadata', () => {
const fullAPIMock = { findRef: jest.fn(), getRefs: jest.fn() };
... |
1,061 | 0 | petrpan-code/storybookjs/storybook/code/lib/manager-api/src | petrpan-code/storybookjs/storybook/code/lib/manager-api/src/tests/globals.test.ts | import { EventEmitter } from 'events';
import { SET_STORIES, SET_GLOBALS, UPDATE_GLOBALS, GLOBALS_UPDATED } from '@storybook/core-events';
import type { API } from '../index';
import type { SubAPI } from '../modules/globals';
import { init as initModule } from '../modules/globals';
import type { ModuleArgs } from '../... |
1,067 | 0 | petrpan-code/storybookjs/storybook/code/lib/manager-api/src | petrpan-code/storybookjs/storybook/code/lib/manager-api/src/tests/refs.test.ts | import { global } from '@storybook/global';
import { getSourceType, init as initRefs } from '../modules/refs';
const { fetch } = global;
const fetchMock = jest.mocked(fetch);
jest.mock('@storybook/global', () => {
const globalMock = {
fetch: jest.fn(() => Promise.resolve({})),
REFS: {
fake: {
... |
1,071 | 0 | petrpan-code/storybookjs/storybook/code/lib/manager-api/src | petrpan-code/storybookjs/storybook/code/lib/manager-api/src/tests/stories.test.ts | /// <reference types="@types/jest" />;
import {
STORY_ARGS_UPDATED,
UPDATE_STORY_ARGS,
RESET_STORY_ARGS,
SET_STORIES,
STORY_SPECIFIED,
STORY_PREPARED,
STORY_INDEX_INVALIDATED,
CONFIG_ERROR,
SET_INDEX,
CURRENT_STORY_WAS_SET,
STORY_MISSING,
DOCS_PREPARED,
} from '@storybook/core-events';
import { ... |
1,079 | 0 | petrpan-code/storybookjs/storybook/code/lib/node-logger | petrpan-code/storybookjs/storybook/code/lib/node-logger/src/index.test.ts | import { info, warn } from 'npmlog';
import { logger } from '.';
globalThis.console = { log: jest.fn() } as any;
jest.mock('npmlog', () => ({
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
levels: {
silly: -Infinity,
verbose: 1000,
info: 2000,
timing: 2500,
http: 3000,
notice: 350... |
1,086 | 0 | petrpan-code/storybookjs/storybook/code/lib/postinstall | petrpan-code/storybookjs/storybook/code/lib/postinstall/src/codemods.test.ts | import path from 'path';
import fs from 'fs';
import 'jest-specific-snapshot';
// @ts-expect-error (broken types)
import { applyTransform } from 'jscodeshift/dist/testUtils';
jest.mock('@storybook/node-logger');
const inputRegExp = /\.input\.js$/;
const fixturesDir = path.resolve(__dirname, './__testfixtures__');
fs... |
1,087 | 0 | petrpan-code/storybookjs/storybook/code/lib/postinstall | petrpan-code/storybookjs/storybook/code/lib/postinstall/src/frameworks.test.ts | import { getFrameworks } from './frameworks';
const REACT = {
'@storybook/react': '5.2.5',
};
const VUE = {
'@storybook/vue': '5.2.5',
};
const NONE = {
'@storybook/preview-api': '5.2.5',
lodash: '^4.17.15',
};
describe('getFrameworks', () => {
it('single framework', () => {
const frameworks = getFram... |
1,121 | 0 | petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules | petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/addons/make-decorator.test.ts | import type { Addon_StoryContext } from '@storybook/types';
import { makeDecorator } from './make-decorator';
// Copy & paste from internal api: client-api/src/client_api
type DecoratorFn = (fn: any, context: Addon_StoryContext) => any;
const defaultDecorateStory = (getStory: any, decorators: DecoratorFn[]) =>
deco... |
1,124 | 0 | petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules | petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/client-api/ClientApi.test.ts | import { addons, mockChannel } from '../addons';
import { ClientApi } from './ClientApi';
beforeEach(() => {
addons.setChannel(mockChannel());
});
describe('ClientApi', () => {
describe('getStoryIndex', () => {
it('should remember the order that files were added in', async () => {
const clientApi = new ... |
1,131 | 0 | petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules | petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/core-client/start.test.ts | /* eslint-disable no-underscore-dangle */
/**
* @jest-environment jsdom
*/
// import { describe, it, beforeAll, beforeEach, afterAll, afterEach, jest } from '@jest/globals';
import { STORY_RENDERED, STORY_UNCHANGED, SET_INDEX, CONFIG_ERROR } from '@storybook/core-events';
import type { ModuleExports, Path } from '@... |
1,134 | 0 | petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules | petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts | /**
* @jest-environment jsdom
*/
import React from 'react';
import { global } from '@storybook/global';
import type { RenderContext } from '@storybook/types';
import { addons, mockChannel as createMockChannel } from '../addons';
import { PreviewWeb } from './PreviewWeb';
import { WebView } from './WebView';
import ... |
1,136 | 0 | petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules | petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts | /**
* @jest-environment jsdom
*/
import { global } from '@storybook/global';
import merge from 'lodash/merge.js';
import {
CONFIG_ERROR,
CURRENT_STORY_WAS_SET,
DOCS_RENDERED,
FORCE_REMOUNT,
FORCE_RE_RENDER,
GLOBALS_UPDATED,
IGNORED_EXCEPTION,
PREVIEW_KEYDOWN,
RESET_STORY_ARGS,
SET_CURRENT_STORY,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.