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
3 changes: 1 addition & 2 deletions packages/rstack/src/fmt/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,5 +366,4 @@ const runFmtCLI = async (args: string[]): Promise<void> => {
}
};

export { fmtHelpMessage, parseFmtCLIArgs, prettyTime, runFmtCLI };
export type { ParsedFmtCLIArgs };
export { runFmtCLI };
2 changes: 1 addition & 1 deletion packages/rstack/src/fmt/workerPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ const createFmtWorkerPool = async (
};
};

export { createFmtWorkerPool, getFmtWorkerCount };
export { createFmtWorkerPool };
export type { FmtWorkerPool };
2 changes: 1 addition & 1 deletion packages/rstack/src/projectCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ const ensureProjectCacheDir = async (rootPath: string): Promise<ProjectCacheResu
}
};

export { ensureProjectCacheDir, getProjectCacheDir };
export { ensureProjectCacheDir };
export type { ProjectCacheResult };
22 changes: 0 additions & 22 deletions packages/rstack/tests/fmt/__snapshots__/cli.test.ts.snap

This file was deleted.

212 changes: 0 additions & 212 deletions packages/rstack/tests/fmt/cli.test.ts

This file was deleted.

62 changes: 0 additions & 62 deletions packages/rstack/tests/fmt/format.test.ts

This file was deleted.

25 changes: 0 additions & 25 deletions packages/rstack/tests/fmt/pathHelpers.test.ts

This file was deleted.

34 changes: 0 additions & 34 deletions packages/rstack/tests/fmt/runnerWorkerPreflight.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { readFileSync } from 'node:fs';
import path from 'node:path';
import { beforeEach, expect, rs, test } from 'rstack/test';
import { cacheNamespace, createOptionsHasher } from '../../src/fmt/cacheIdentity.ts';
Expand All @@ -22,39 +21,6 @@ beforeEach(() => {
mocks.createFmtWorkerPoolCalls.length = 0;
});

const createRequest = (filePath: string): FmtFileRequest => ({
path: filePath,
options: {
parser: 'typescript',
},
});

test('starts the worker pool before formatting a single file', async () => {
await withTempProject(async (rootPath) => {
const filePath = writeProjectFile(rootPath, 'index.ts', 'const value=1');

await expect(
runFmtFiles({
files: [createRequest(filePath)],
mode: 'write',
maxWorkers: 1,
}),
).rejects.toThrow('worker startup failed');

expect(mocks.createFmtWorkerPoolCalls).toEqual([[1, 1]]);
expect(readFileSync(filePath, 'utf8')).toBe('const value=1');
});
});

test('does not start the worker pool when there are no files', async () => {
await expect(runFmtFiles({ files: [], mode: 'write' })).resolves.toMatchObject({
files: [],
exitCode: 0,
processedFileCount: 0,
});
expect(mocks.createFmtWorkerPoolCalls).toEqual([]);
});

test('does not start the worker pool when every parser result is cached as unsupported', async () => {
await withTempProject(async (rootPath) => {
const filePath = writeProjectFile(rootPath, 'example.unknown', 'plain text');
Expand Down
Loading