Skip to content

Commit 7004f5c

Browse files
committed
Skip older node versions
1 parent 59a1166 commit 7004f5c

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

packages/cloudflare/test/workflow.test.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import { deterministicTraceIdFromInstanceId, instrumentWorkflowWithSentry } from
55

66
const NODE_MAJOR_VERSION = parseInt(process.versions.node.split('.')[0]!);
77

8-
if (NODE_MAJOR_VERSION < 20) {
9-
process.exit(0); // Skip tests for Node.js versions below 20
10-
}
11-
128
const mockStep: WorkflowStep = {
139
do: vi
1410
.fn()
@@ -81,7 +77,11 @@ describe('workflows', () => {
8177
expect(await deterministicTraceIdFromInstanceId(INSTANCE_ID)).toMatch(UUID_WITHOUT_HYPHENS_REGEX);
8278
});
8379

84-
test('Calls expected functions', async () => {
80+
test('Calls expected functions', async ctx => {
81+
if (NODE_MAJOR_VERSION < 20) {
82+
ctx.skip();
83+
return;
84+
}
8585
class BasicTestWorkflow {
8686
constructor(_ctx: ExecutionContext, _env: unknown) {}
8787

@@ -146,7 +146,11 @@ describe('workflows', () => {
146146
]);
147147
});
148148

149-
test('Calls expected functions with non-uuid instance id', async () => {
149+
test('Calls expected functions with non-uuid instance id', async ctx => {
150+
if (NODE_MAJOR_VERSION < 20) {
151+
ctx.skip();
152+
return;
153+
}
150154
class BasicTestWorkflow {
151155
constructor(_ctx: ExecutionContext, _env: unknown) {}
152156

@@ -228,7 +232,12 @@ describe('workflows', () => {
228232
}
229233
}
230234

231-
test('Captures step errors', async () => {
235+
test('Captures step errors', async ctx => {
236+
if (NODE_MAJOR_VERSION < 20) {
237+
ctx.skip();
238+
return;
239+
}
240+
232241
const TestWorkflowInstrumented = instrumentWorkflowWithSentry(getSentryOptions, ErrorTestWorkflow as any);
233242
const workflow = new TestWorkflowInstrumented(mockContext, {}) as ErrorTestWorkflow;
234243
const event = { payload: {}, timestamp: new Date(), instanceId: INSTANCE_ID };
@@ -367,7 +376,12 @@ describe('workflows', () => {
367376
]);
368377
});
369378

370-
test('Sampled random via instanceId', async () => {
379+
test('Sampled random via instanceId', async ctx => {
380+
if (NODE_MAJOR_VERSION < 20) {
381+
ctx.skip();
382+
return;
383+
}
384+
371385
const TestWorkflowInstrumented = instrumentWorkflowWithSentry(
372386
// Override the tracesSampleRate to 0.4 to be below the sampleRand
373387
// calculated from the instanceId

0 commit comments

Comments
 (0)