mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
fix unit tests
This commit is contained in:
parent
1ae40243b3
commit
55a2fd4183
@ -7,6 +7,7 @@ import chalk from 'chalk';
|
||||
import { readConfig, writeConfig } from '@storybook/core/csf-tools';
|
||||
import type { JsPackageManager } from '@storybook/core/common';
|
||||
import { paddedLog } from '@storybook/core/common';
|
||||
import fs from 'node:fs';
|
||||
|
||||
export const SUPPORTED_ESLINT_EXTENSIONS = ['js', 'cjs', 'json'];
|
||||
const UNSUPPORTED_ESLINT_EXTENSIONS = ['yaml', 'yml'];
|
||||
@ -14,7 +15,7 @@ const UNSUPPORTED_ESLINT_EXTENSIONS = ['yaml', 'yml'];
|
||||
export const findEslintFile = () => {
|
||||
const filePrefix = '.eslintrc';
|
||||
const unsupportedExtension = UNSUPPORTED_ESLINT_EXTENSIONS.find((ext: string) =>
|
||||
fse.existsSync(`${filePrefix}.${ext}`)
|
||||
fs.existsSync(`${filePrefix}.${ext}`)
|
||||
);
|
||||
|
||||
if (unsupportedExtension) {
|
||||
@ -22,7 +23,7 @@ export const findEslintFile = () => {
|
||||
}
|
||||
|
||||
const extension = SUPPORTED_ESLINT_EXTENSIONS.find((ext: string) =>
|
||||
fse.existsSync(`${filePrefix}.${ext}`)
|
||||
fs.existsSync(`${filePrefix}.${ext}`)
|
||||
);
|
||||
return extension ? `${filePrefix}.${extension}` : null;
|
||||
};
|
||||
|
@ -62,13 +62,13 @@ export default {
|
||||
'@storybook/cli': '8.3.0-alpha.0',
|
||||
'@storybook/codemod': '8.3.0-alpha.0',
|
||||
'@storybook/core-webpack': '8.3.0-alpha.0',
|
||||
'create-storybook': '8.2.0-beta.3',
|
||||
'create-storybook': '8.3.0-alpha.0',
|
||||
'@storybook/csf-plugin': '8.3.0-alpha.0',
|
||||
'@storybook/instrumenter': '8.3.0-alpha.0',
|
||||
'@storybook/react-dom-shim': '8.3.0-alpha.0',
|
||||
'@storybook/source-loader': '8.3.0-alpha.0',
|
||||
'@storybook/test': '8.3.0-alpha.0',
|
||||
'@storybook/toolbox': '8.2.0-beta.3',
|
||||
'@storybook/toolbox': '8.3.0-alpha.0',
|
||||
'@storybook/preset-create-react-app': '8.3.0-alpha.0',
|
||||
'@storybook/preset-html-webpack': '8.3.0-alpha.0',
|
||||
'@storybook/preset-preact-webpack': '8.3.0-alpha.0',
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "create-storybook",
|
||||
"version": "8.2.0-beta.3",
|
||||
"version": "8.3.0-alpha.0",
|
||||
"description": "Initialize Storybook into your project",
|
||||
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/lib/create-storybook",
|
||||
"bugs": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/toolbox",
|
||||
"version": "8.2.0-beta.3",
|
||||
"version": "8.3.0-alpha.0",
|
||||
"description": "Storybook's Toolbox",
|
||||
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/lib/toolbox",
|
||||
"bugs": {
|
||||
|
@ -23,10 +23,6 @@ const checkAngularBuilders = async ({
|
||||
vi.mock('storybook/internal/cli', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import('storybook/internal/cli')>()),
|
||||
isNxProject: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('storybook/internal/cli', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import('storybook/internal/cli')>()),
|
||||
AngularJSON: vi.fn(),
|
||||
}));
|
||||
|
||||
|
@ -32,8 +32,8 @@ vi.mock('storybook/internal/common', async (importOriginal) => {
|
||||
describe.each([
|
||||
['│ │ │ ├── @babel/code-frame@7.10.3 deduped', null],
|
||||
[
|
||||
'│ ├── "storybook/internal/theming@6.0.0-beta.37 extraneous',
|
||||
{ package: 'storybook/internal/theming', version: '6.0.0-beta.37' },
|
||||
'│ ├── "@storybook/core/theming@6.0.0-beta.37 extraneous',
|
||||
{ package: '@storybook/core/theming', version: '6.0.0-beta.37' },
|
||||
],
|
||||
[
|
||||
'├─┬ @storybook/preset-create-react-app@3.1.2',
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { sync as spawnSync } from 'cross-spawn';
|
||||
import { telemetry } from 'storybook/internal/telemetry';
|
||||
import semver, { eq, lt, prerelease } from 'semver';
|
||||
import semver, { eq, lt, prerelease, clean } from 'semver';
|
||||
import { logger } from 'storybook/internal/node-logger';
|
||||
import { withTelemetry } from 'storybook/internal/core-server';
|
||||
import {
|
||||
@ -34,7 +34,7 @@ const versionRegex = /(@storybook\/[^@]+)@(\S+)/;
|
||||
export const getStorybookVersion = (line: string) => {
|
||||
if (line.startsWith('npm ')) return null;
|
||||
const match = versionRegex.exec(line);
|
||||
if (!match || !semver.clean(match[2])) return null;
|
||||
if (!match || !clean(match[2])) return null;
|
||||
return {
|
||||
package: match[1],
|
||||
version: match[2],
|
||||
|
Loading…
x
Reference in New Issue
Block a user