Skip to content

Commit 140aac0

Browse files
committed
Extend timeouts!
1 parent 72db45e commit 140aac0

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

test/e2e.test.mjs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ const __dirname = import.meta.dirname || new URL('.', import.meta.url).pathname;
66

77
const NODE_MAJOR_VERSION = parseInt(process.versions.node.split('.')[0], 10);
88

9+
// macOS emulated x64 in CI is very slow!
10+
const timeout = process.env.CI && process.platform === 'darwin' ? 60000 : 20000;
11+
912
function runTest(...paths) {
1013
console.time('Test Run');
1114
const file = join(...paths);
1215
const args = NODE_MAJOR_VERSION === 22 ? ['--experimental-async-context-frame', file] : [file];
1316
const result = spawnSync('node', args);
14-
const stdoutLines = result.stdout?.toString().split('\n').filter(line => line.trim() !== '');
15-
const stderrLines = result.stderr?.toString().split('\n').filter(line => line.trim() !== '');
17+
const stdout = result.stdout?.toString().split('\n').filter(line => line.trim() !== '');
18+
const stderr = result.stderr?.toString().split('\n').filter(line => line.trim() !== '');
1619

1720
let trace;
18-
for (const line of stdoutLines) {
21+
for (const line of stdout) {
1922
try {
2023
trace = JSON.parse(line);
2124
break;
@@ -24,19 +27,18 @@ function runTest(...paths) {
2427
}
2528
}
2629

27-
if (stdoutLines.length > 0) {
28-
console.log('stdout:', stdoutLines);
30+
console.timeEnd('Test Run');
31+
if (stdout.length > 0) {
32+
console.log('stdout:', stdout);
2933
}
30-
if (stderrLines.length > 0) {
31-
console.log('stderr:', stderrLines);
34+
if (stderr.length > 0) {
35+
console.log('stderr:', stderr);
3236
}
3337

34-
console.timeEnd('Test Run');
35-
36-
return { status: result.status, stdoutLines, trace };
38+
return { status: result.status, stdout, trace };
3739
}
3840

39-
describe('e2e Tests', { timeout: 60000 }, () => {
41+
describe('e2e Tests', { timeout }, () => {
4042
test('Capture stack trace from multiple threads', () => {
4143
const result = runTest(__dirname, 'stack-traces.js')
4244

@@ -90,7 +92,7 @@ describe('e2e Tests', { timeout: 60000 }, () => {
9092
}));
9193
});
9294

93-
test('detect stalled thread', { timeout: 20000 }, () => {
95+
test('detect stalled thread', () => {
9496
const result = runTest(__dirname, 'stalled.js');
9597

9698
expect(result.status).toEqual(0);
@@ -125,7 +127,7 @@ describe('e2e Tests', { timeout: 60000 }, () => {
125127
}));
126128
});
127129

128-
test('async storage state', { timeout: 20000 }, (ctx) => {
130+
test('async storage state', (ctx) => {
129131
if (NODE_MAJOR_VERSION < 22) {
130132
ctx.skip();
131133
return;
@@ -162,11 +164,10 @@ describe('e2e Tests', { timeout: 60000 }, () => {
162164
}));
163165
});
164166

165-
test('can be disabled', { timeout: 20000 }, () => {
167+
test('can be disabled', () => {
166168
const result = runTest(__dirname, 'stalled-disabled.js');
167169

168170
expect(result.status).toEqual(0);
169-
170-
expect(result.stdoutLines).toContain('complete');
171+
expect(result.stdout).toContain('complete');
171172
});
172173
});

0 commit comments

Comments
 (0)