mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 04:18:05 +00:00
fix(ci): keep fast bucket stable for commonjs tests
This commit is contained in:
@@ -24,6 +24,12 @@ const slowTests = [
|
||||
'tests/unit/web-server/cursor-routes.test.ts',
|
||||
'tests/unit/web-server/websearch-routes.test.ts',
|
||||
];
|
||||
// CommonJS-heavy JS suites stay slow by default because many of them mutate
|
||||
// module cache or process state. Opt them into `test:fast` only after they are
|
||||
// proven stable in the mixed fast bucket.
|
||||
const fastJsTests = new Set([
|
||||
'tests/unit/flag-parsing-simple.test.js',
|
||||
]);
|
||||
|
||||
const filePattern = /(\.test\.(c|m)?[jt]s|\.spec\.(c|m)?[jt]s|-test\.(c|m)?[jt]s)$/;
|
||||
|
||||
@@ -59,6 +65,10 @@ function shouldForceSlow(file) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (/\.(c|m)?js$/.test(file) && !fastJsTests.has(file)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return readsBuiltDist(file);
|
||||
}
|
||||
|
||||
@@ -149,6 +159,7 @@ if (require.main === module) {
|
||||
|
||||
module.exports = {
|
||||
slowTests,
|
||||
fastJsTests,
|
||||
readsBuiltDist,
|
||||
shouldForceSlow,
|
||||
getDiscoveredTests,
|
||||
|
||||
@@ -18,6 +18,10 @@ describe('run-test-bucket', () => {
|
||||
expect(bucket.shouldForceSlow('tests/unit/flag-parsing-simple.test.js')).toBe(false);
|
||||
});
|
||||
|
||||
test('keeps non-allowlisted javascript tests in the slow bucket', () => {
|
||||
expect(bucket.shouldForceSlow('tests/unit/commands/persist-command.test.js')).toBe(true);
|
||||
});
|
||||
|
||||
test('still forces dist-dependent tests into the slow bucket', () => {
|
||||
expect(bucket.shouldForceSlow('tests/unit/config-dir-override.test.js')).toBe(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user