Skip to content

Commit b8402ab

Browse files
test: increase timeout for validate.test.ts to handle slow ts-node spawns in CI
The validate.test.ts spawns ts-node processes which can be slow, especially in CI. - Increased jest.setTimeout to 30 seconds for the test suite - Increased spawnSync timeout from 10s to 25s - This fixes test failures in CI where the test took 27s to complete
1 parent 77ddeb7 commit b8402ab

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cloudevents/tools/validator/__tests__/validate.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function runValidator(schemaPath: string, dataPath: string, baseDir?: string): {
1919
const args = baseDir ? ['--base', baseDir, schemaPath, dataPath] : [schemaPath, dataPath];
2020
const result = spawnSync('npx', ['ts-node', SCRIPT_PATH, ...args], {
2121
encoding: 'utf-8',
22-
timeout: 10000 // Increased timeout for ts-node
22+
timeout: 25000 // Increased timeout for ts-node in CI
2323
});
2424

2525
return {
@@ -37,6 +37,9 @@ function runValidator(schemaPath: string, dataPath: string, baseDir?: string): {
3737
}
3838

3939
describe('validate.ts', () => {
40+
// Increase timeout for this suite since it spawns ts-node processes
41+
jest.setTimeout(30000); // 30 seconds per test
42+
4043
beforeEach(() => {
4144
// Create test directory
4245
if (!fs.existsSync(TEST_DIR)) {
@@ -53,7 +56,7 @@ describe('validate.ts', () => {
5356

5457
describe('command line arguments', () => {
5558
it('should exit with error when no arguments provided', () => {
56-
const result = spawnSync('npx', ['ts-node', SCRIPT_PATH], { encoding: 'utf-8', timeout: 10000 });
59+
const result = spawnSync('npx', ['ts-node', SCRIPT_PATH], { encoding: 'utf-8', timeout: 25000 });
5760
expect(result.status).not.toBe(0);
5861
expect(result.stderr).toContain('Usage:');
5962
});

0 commit comments

Comments
 (0)