small fixes

This commit is contained in:
Norbert de Langen 2022-11-14 14:33:38 +01:00
parent 8eb96195a5
commit e10b02f392
No known key found for this signature in database
GPG Key ID: FD0E78AF9A837762
4 changed files with 20 additions and 50 deletions

View File

@ -19,6 +19,7 @@ import { buildStaticStandalone } from './build-static';
import { outputStats } from './utils/output-stats';
// @ts-expect-error (not strict)
const { SNAPSHOT_OS } = global;
const mkdtemp = promisify(mkdtempCb);
const { packageJson } = readUpSync({ cwd: __dirname });
@ -33,6 +34,7 @@ jest.mock('webpack', () => {
const actual = jest.requireActual('webpack');
Object.keys(actual).forEach((key) => {
// @ts-expect-error (not strict)
value[key] = actual[key];
});
return value;
@ -87,7 +89,9 @@ jest.mock('@storybook/store', () => {
});
jest.mock('http', () => ({
// @ts-expect-error (not strict)
...jest.requireActual('http'),
// @ts-expect-error (not strict)
createServer: () => ({ listen: (_options, cb) => cb(), on: jest.fn() }),
}));
jest.mock('ws');
@ -129,7 +133,7 @@ const baseOptions = {
const ROOT = getProjectRoot();
const CWD = process.cwd();
const NODE_MODULES = /.*node_modules/g;
const cleanRoots = (obj): any => {
const cleanRoots = (obj: any): any => {
if (!obj) return obj;
if (typeof obj === 'string')
return obj.replace(CWD, 'CWD').replace(ROOT, 'ROOT').replace(NODE_MODULES, 'NODE_MODULES');
@ -148,15 +152,18 @@ const cleanRoots = (obj): any => {
return obj;
};
const getConfig = (fn: any, name): Configuration | null => {
const call = fn.mock.calls.find((c) => c[0].name === name);
const getConfig = (fn: any, name: string): Configuration | null => {
const call = fn.mock.calls.find((c: any) => c[0].name === name);
if (!call) {
return null;
}
return call[0];
};
const prepareSnap = (get: any, name): Pick<Configuration, 'module' | 'entry' | 'plugins'> => {
const prepareSnap = (
get: any,
name: string
): Pick<Configuration, 'module' | 'entry' | 'plugins'> => {
const config = getConfig(get(), name);
if (!config) {
return null;
@ -173,7 +180,8 @@ const snap = (name: string) => `__snapshots__/${name}`;
// FIXME: we no longer have test cases
// eslint-disable-next-line jest/no-disabled-tests
describe.skip('FIXME', () => {
describe.each([[]])('%s', (example) => {
// @ts-expect-error (not strict)
describe.each([[]])('%s', (example: string) => {
describe.each([
['manager', managerExecutor],
['preview', previewExecutor],
@ -209,8 +217,8 @@ describe.skip('FIXME', () => {
});
});
const progressPlugin = (config) =>
config.plugins.find((p) => p.constructor.name === 'ProgressPlugin');
const progressPlugin = (config: any) =>
config.plugins.find((p: any) => p.constructor.name === 'ProgressPlugin');
describe('dev cli flags', () => {
beforeEach(async () => {
@ -271,6 +279,7 @@ describe('dev cli flags', () => {
it('production mode', async () => {
expect.assertions(1);
// @ts-expect-error (not strict)
await expect(buildStaticStandalone(optionsWithInvalidStaticDir)).rejects.toThrow(
"Won't copy root directory. Check your staticDirs!"
);

View File

@ -1,4 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"skipLibCheck": true
},
"include": ["src/**/*"]
}

View File

@ -1,7 +1,6 @@
{
"compileOnSave": false,
"compilerOptions": {
"noEmit": true,
"baseUrl": ".",
"incremental": false,
"noImplicitAny": true,

View File

@ -6169,7 +6169,6 @@ __metadata:
"@storybook/core-common": 7.0.0-alpha.49
"@storybook/mdx2-csf": next
"@storybook/node-logger": 7.0.0-alpha.49
"@storybook/preview": 7.0.0-alpha.49
"@storybook/preview-web": 7.0.0-alpha.49
"@storybook/source-loader": 7.0.0-alpha.49
"@storybook/types": 7.0.0-alpha.49
@ -6178,8 +6177,6 @@ __metadata:
"@vitejs/plugin-react": ^2.0.0
browser-assert: ^1.2.1
es-module-lexer: ^0.9.3
express: ^4.17.1
fs-extra: ^9.0.1
glob: ^7.2.0
glob-promise: ^4.2.0
magic-string: ^0.26.1
@ -6206,7 +6203,6 @@ __metadata:
"@storybook/core-events": 7.0.0-alpha.49
"@storybook/core-webpack": 7.0.0-alpha.49
"@storybook/node-logger": 7.0.0-alpha.49
"@storybook/preview": 7.0.0-alpha.49
"@storybook/preview-web": 7.0.0-alpha.49
"@storybook/router": 7.0.0-alpha.49
"@storybook/store": 7.0.0-alpha.49
@ -6223,9 +6219,7 @@ __metadata:
browser-assert: ^1.2.1
case-sensitive-paths-webpack-plugin: ^2.4.0
css-loader: ^6.7.1
express: ^4.17.1
fork-ts-checker-webpack-plugin: ^7.2.8
fs-extra: ^9.0.1
global: ^4.4.0
html-webpack-plugin: ^5.5.0
path-browserify: ^1.0.1
@ -6645,7 +6639,7 @@ __metadata:
languageName: node
linkType: hard
"@storybook/csf@npm:0.0.2-next.5, @storybook/csf@npm:next":
"@storybook/csf@npm:0.0.2-next.5":
version: 0.0.2-next.5
resolution: "@storybook/csf@npm:0.0.2-next.5"
dependencies:
@ -7235,41 +7229,6 @@ __metadata:
languageName: unknown
linkType: soft
"@storybook/preview@7.0.0-alpha.49, @storybook/preview@workspace:lib/preview":
version: 0.0.0-use.local
resolution: "@storybook/preview@workspace:lib/preview"
dependencies:
"@storybook/api": 7.0.0-alpha.49
"@storybook/channel-postmessage": 7.0.0-alpha.49
"@storybook/channel-websocket": 7.0.0-alpha.49
"@storybook/channels": 7.0.0-alpha.49
"@storybook/client-logger": 7.0.0-alpha.49
"@storybook/core-client": 7.0.0-alpha.49
"@storybook/core-common": 7.0.0-alpha.49
"@storybook/core-events": 7.0.0-alpha.49
"@storybook/csf": next
"@storybook/preview-web": 7.0.0-alpha.49
"@storybook/router": 7.0.0-alpha.49
"@storybook/theming": 7.0.0-alpha.49
"@storybook/types": 7.0.0-alpha.49
"@types/qs": ^6.9.5
"@types/webpack-env": ^1.16.4
ansi-to-html: ^0.6.11
dequal: ^2.0.2
global: ^4.4.0
lodash: ^4.17.21
memoizerific: ^1.11.3
qs: ^6.10.0
react: 16.14.0
slash: ^3.0.0
synchronous-promise: ^2.0.15
ts-dedent: ^2.0.0
ts-jest: ^28.0.8
typescript: ~4.6.3
util-deprecate: ^1.0.2
languageName: unknown
linkType: soft
"@storybook/react-docgen-typescript-plugin@npm:1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0":
version: 1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0
resolution: "@storybook/react-docgen-typescript-plugin@npm:1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0"