Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ node
storybook-out
coverage
package.json.backup
tests-file.xml
1 change: 0 additions & 1 deletion bin-src/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {

vi.mock('jsonfile', async (importOriginal) => {
return {
// @ts-expect-error TS does not think actual is an object, but it's fine.
...(await importOriginal()),
writeFile: vi.fn(() => Promise.resolve()),
};
Expand Down
2 changes: 1 addition & 1 deletion node-src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ vi.mock('execa', async (importOriginal) => {
const mockedBuildCommand = 'mocked build command';
vi.mock(import('./lib/e2e'), async (importOriginal) => ({
...(await importOriginal()),
getE2EBuildCommand: () => mockedBuildCommand,
getE2EBuildCommand: async () => mockedBuildCommand,
}));

const execa = vi.mocked(execaDefault);
Expand Down
4 changes: 2 additions & 2 deletions node-src/lib/react-native/generateManifest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import TestLogger from '../testLogger';
import { generateManifest } from './generateManifest';

// Mock all the necessary bits for importing in a Storybook 10+ project
vi.mock('module', () => ({
vi.mock('node:module', () => ({
createRequire: vi.fn().mockReturnValue({
resolve: vi.fn().mockReturnValue('/fake/path/to/@storybook/react-native/node'),
}),
}));

vi.mock('url', () => ({
vi.mock('node:url', () => ({
pathToFileURL: vi.fn().mockReturnValue({ href: '@storybook/react-native/node' }),
}));

Expand Down
30 changes: 15 additions & 15 deletions node-src/lib/testLogger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { vi } from 'vitest';
import { Mock, vi } from 'vitest';

import { Logger } from './log';

Expand All @@ -9,20 +9,20 @@ export default class TestLogger implements Logger {
entries: any[];
errors: any[];
warnings: any[];
error: ReturnType<typeof vi.fn>;
warn: ReturnType<typeof vi.fn>;
info: ReturnType<typeof vi.fn>;
log: ReturnType<typeof vi.fn>;
debug: ReturnType<typeof vi.fn>;
file: ReturnType<typeof vi.fn>;
queue: ReturnType<typeof vi.fn>;
flush: ReturnType<typeof vi.fn>;
setLevel: ReturnType<typeof vi.fn>;
setInteractive: ReturnType<typeof vi.fn>;
setLogFile: ReturnType<typeof vi.fn>;
getLevel: ReturnType<typeof vi.fn>;
pause: ReturnType<typeof vi.fn>;
resume: ReturnType<typeof vi.fn>;
error: Mock;
warn: Mock;
info: Mock;
log: Mock;
debug: Mock;
file: Mock;
queue: Mock;
flush: Mock;
setLevel: Mock;
setInteractive: Mock;
setLogFile: Mock;
getLevel: Mock;
pause: Mock;
resume: Mock;

constructor() {
this.entries = [];
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"trace": "./dist/bin.js trace",
"trim-stats": "./dist/bin.js trim-stats-file",
"storybook": "storybook dev -p 9009",
"test": "vitest run --coverage && vitest run -c vitest.no-threads.config.ts",
"test": "vitest run --coverage",
"typescript:check": "tsc --project ./tsconfig.json --noEmit",
"prepare": "yarn run build",
"dev": "tsup --watch",
Expand Down Expand Up @@ -129,7 +129,7 @@
"@types/ws": "^8",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"@vitest/coverage-v8": "^2.0.5",
"@vitest/coverage-v8": "^4.1.2",
"ansi-html": "0.0.9",
"any-observable": "^0.5.1",
"archiver": "^5.3.0",
Expand Down Expand Up @@ -208,9 +208,9 @@
"typescript-eslint": "^7.11.0",
"util-deprecate": "^1.0.2",
"uuid": "^8.3.2",
"vite": "^4.4.9",
"vite": "^8.0.3",
Comment thread
codykaup marked this conversation as resolved.
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^2.0.5",
"vitest": "^4.1.2",
"why-is-node-running": "^2.1.2",
"ws": "^8.18.2",
"xxhash-wasm": "^1.0.2",
Expand Down
13 changes: 3 additions & 10 deletions vitest.config.mts
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import tsconfigPaths from 'vite-tsconfig-paths';
import { configDefaults, coverageConfigDefaults, defineConfig, Plugin } from 'vitest/config';
import { defineConfig, Plugin } from 'vitest/config';

export default defineConfig({
test: {
exclude: [...configDefaults.exclude, '**/getParentCommits.test.ts'],
clearMocks: true, // Clear all mocks between each test
coverage: {
provider: 'v8',
exclude: [
'vitest.no-threads.config.ts',
'scripts/**',
'**/*.stories.{t,j}s',
'node-src/lib/testLogger.ts',
...coverageConfigDefaults.exclude,
],
include: ['{bin,node}-src/**/*.{ts,tsx}', 'isChromatic.{mjs,js}'],
exclude: ['**/*.stories.{t,j}s', '**/lib/testLogger.ts', '**/__mocks__/**'],
Comment thread
codykaup marked this conversation as resolved.
},
},
plugins: [tsconfigPaths() as Plugin],
Expand Down
13 changes: 0 additions & 13 deletions vitest.no-threads.config.ts
Comment thread
codykaup marked this conversation as resolved.

This file was deleted.

Loading
Loading