mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 04:15:52 +00:00
fix(test): run bucket paths explicitly
This commit is contained in:
1 parent
7e6e12d008
commit
27c8a9570b
12 files changed
+668
-304
No files matched your search
@@ -44,6 +44,103 @@ describe('run-test-bucket', () => {
|
||||
expect(discovered).toContain('src/cliproxy/types/__tests__/types-backward-compat.test.ts');
|
||||
});
|
||||
|
||||
test('passes selected tests to Bun as explicit relative paths', () => {
|
||||
const args = bucket.getBunArgs('fast', [
|
||||
'tests/unit/example.test.ts',
|
||||
'src/cliproxy/types/__tests__/types-backward-compat.test.ts',
|
||||
]);
|
||||
|
||||
expect(args).toEqual([
|
||||
'test',
|
||||
'./tests/unit/example.test.ts',
|
||||
'./src/cliproxy/types/__tests__/types-backward-compat.test.ts',
|
||||
]);
|
||||
});
|
||||
|
||||
test('keeps slow bucket concurrency flag before explicit test paths', () => {
|
||||
const args = bucket.getBunArgs('slow', ['tests/integration/example.test.ts']);
|
||||
|
||||
expect(args).toEqual(['test', '--max-concurrency=1', './tests/integration/example.test.ts']);
|
||||
});
|
||||
|
||||
test('isolates src tests while keeping already-covered tests in a shared run', () => {
|
||||
const runs = bucket.getBunRuns('fast', [
|
||||
'tests/unit/scripts/run-test-bucket.test.js',
|
||||
'src/cliproxy/types/__tests__/types-backward-compat.test.ts',
|
||||
'src/errors/__tests__/error-types.test.ts',
|
||||
]);
|
||||
|
||||
expect(runs.map((run) => run.label)).toEqual([
|
||||
'shared',
|
||||
'src/cliproxy/types/__tests__/types-backward-compat.test.ts',
|
||||
'src/errors/__tests__/error-types.test.ts',
|
||||
]);
|
||||
expect(runs[0].selected).toEqual(['tests/unit/scripts/run-test-bucket.test.js']);
|
||||
expect(runs[0].bunArgs).toEqual(['test', './tests/unit/scripts/run-test-bucket.test.js']);
|
||||
expect(runs[1].bunArgs).toEqual([
|
||||
'test',
|
||||
'./src/cliproxy/types/__tests__/types-backward-compat.test.ts',
|
||||
]);
|
||||
expect(runs[1].quietOnPass).toBe(true);
|
||||
});
|
||||
|
||||
test('isolates known sticky mock suites outside src', () => {
|
||||
const runs = bucket.getBunRuns('fast', [
|
||||
'tests/unit/scripts/run-test-bucket.test.js',
|
||||
'tests/unit/targets/target-registry.test.ts',
|
||||
]);
|
||||
|
||||
expect(runs.map((run) => run.label)).toEqual([
|
||||
'shared',
|
||||
'tests/unit/targets/target-registry.test.ts',
|
||||
]);
|
||||
});
|
||||
|
||||
test('isolates standalone validation scripts that are not Bun test suites', () => {
|
||||
const runs = bucket.getBunRuns('slow', [
|
||||
'tests/integration/cursor-daemon-lifecycle.test.ts',
|
||||
'tests/integration/token-counting-test.js',
|
||||
]);
|
||||
|
||||
expect(bucket.usesBunTestRunner('tests/integration/cursor-daemon-lifecycle.test.ts')).toBe(
|
||||
true
|
||||
);
|
||||
expect(bucket.usesBunTestRunner('tests/integration/token-counting-test.js')).toBe(false);
|
||||
expect(runs.map((run) => run.label)).toEqual([
|
||||
'shared',
|
||||
'tests/integration/token-counting-test.js',
|
||||
]);
|
||||
expect(runs[1].quietOnPass).toBe(true);
|
||||
});
|
||||
|
||||
test('parses Bun file counts from test summaries', () => {
|
||||
expect(bucket.parseBunFileCount('\u001b[32mRan 2559 tests across 272 files\u001b[0m')).toBe(
|
||||
272
|
||||
);
|
||||
});
|
||||
|
||||
test('detects when Bun reports fewer files than the bucket selected', () => {
|
||||
const result = bucket.verifyReportedFileCount(364, 'Ran 2559 tests across 272 files');
|
||||
|
||||
expect(result.ok).toBe(false);
|
||||
expect(result.reportedCount).toBe(272);
|
||||
expect(result.selectedCount).toBe(364);
|
||||
expect(result.message).toContain('Bun ran 272 files');
|
||||
});
|
||||
|
||||
test('skips Bun file-count verification for standalone validation scripts', () => {
|
||||
expect(
|
||||
bucket.shouldVerifyRunFileCount({
|
||||
selected: ['tests/integration/token-counting-test.js'],
|
||||
})
|
||||
).toBe(false);
|
||||
expect(
|
||||
bucket.shouldVerifyRunFileCount({
|
||||
selected: ['tests/integration/cursor-daemon-lifecycle.test.ts'],
|
||||
})
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
test('keeps dist-independent javascript tests in the fast bucket', () => {
|
||||
expect(bucket.shouldForceSlow('tests/unit/flag-parsing-simple.test.js')).toBe(false);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user