Skip to content

Commit 9f25613

Browse files
committed
fix: ignore types for now
1 parent f81c82d commit 9f25613

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed

dev-packages/e2e-tests/test-applications/nextjs-15/tests/vercel-cron-monitoring.test.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@ test('Sends cron check-in envelope for successful cron job', async ({ request })
55
const inProgressEnvelopePromise = waitForEnvelopeItem('nextjs-15', envelope => {
66
return (
77
envelope[0].type === 'check_in' &&
8+
// @ts-expect-error envelope[1] is untyped
89
envelope[1]['monitor_slug'] === '/api/cron-test' &&
10+
// @ts-expect-error envelope[1] is untyped
911
envelope[1]['status'] === 'in_progress'
1012
);
1113
});
1214

1315
const okEnvelopePromise = waitForEnvelopeItem('nextjs-15', envelope => {
1416
return (
1517
envelope[0].type === 'check_in' &&
18+
// @ts-expect-error envelope[1] is untyped
1619
envelope[1]['monitor_slug'] === '/api/cron-test' &&
20+
// @ts-expect-error envelope[1] is untyped
1721
envelope[1]['status'] === 'ok'
1822
);
1923
});
2024

21-
// Simulate Vercel cron request with the special user agent
2225
const response = await request.get('/api/cron-test', {
2326
headers: {
2427
'User-Agent': 'vercel-cron/1.0',
@@ -54,29 +57,31 @@ test('Sends cron check-in envelope for successful cron job', async ({ request })
5457
duration: expect.any(Number),
5558
}),
5659
);
57-
58-
// Check-in IDs should match
60+
// @ts-expect-error envelope[1] is untyped
5961
expect(okEnvelope[1]['check_in_id']).toBe(inProgressEnvelope[1]['check_in_id']);
6062
});
6163

6264
test('Sends cron check-in envelope with error status for failed cron job', async ({ request }) => {
6365
const inProgressEnvelopePromise = waitForEnvelopeItem('nextjs-15', envelope => {
6466
return (
6567
envelope[0].type === 'check_in' &&
68+
// @ts-expect-error envelope[1] is untyped
6669
envelope[1]['monitor_slug'] === '/api/cron-test-error' &&
70+
// @ts-expect-error envelope[1] is untyped
6771
envelope[1]['status'] === 'in_progress'
6872
);
6973
});
7074

7175
const errorEnvelopePromise = waitForEnvelopeItem('nextjs-15', envelope => {
7276
return (
7377
envelope[0].type === 'check_in' &&
78+
// @ts-expect-error envelope[1] is untyped
7479
envelope[1]['monitor_slug'] === '/api/cron-test-error' &&
80+
// @ts-expect-error envelope[1] is untyped
7581
envelope[1]['status'] === 'error'
7682
);
7783
});
7884

79-
// Simulate Vercel cron request with the special user agent
8085
await request.get('/api/cron-test-error', {
8186
headers: {
8287
'User-Agent': 'vercel-cron/1.0',
@@ -110,29 +115,31 @@ test('Sends cron check-in envelope with error status for failed cron job', async
110115
}),
111116
);
112117

113-
// Check-in IDs should match
118+
// @ts-expect-error envelope[1] is untyped
114119
expect(errorEnvelope[1]['check_in_id']).toBe(inProgressEnvelope[1]['check_in_id']);
115120
});
116121

117-
test('Does not send cron check-in envelope for regular requests without vercel-cron user agent', async ({ request }) => {
118-
// Use a flag to track if any check-in envelope is received
122+
test('Does not send cron check-in envelope for regular requests without vercel-cron user agent', async ({
123+
request,
124+
}) => {
119125
let checkInReceived = false;
120126

121-
const checkInPromise = waitForEnvelopeItem('nextjs-15', envelope => {
122-
if (envelope[0].type === 'check_in' && envelope[1]['monitor_slug'] === '/api/cron-test') {
127+
waitForEnvelopeItem('nextjs-15', envelope => {
128+
if (
129+
envelope[0].type === 'check_in' && // @ts-expect-error envelope[1] is untyped
130+
envelope[1]['monitor_slug'] === '/api/cron-test'
131+
) {
123132
checkInReceived = true;
124133
return true;
125134
}
126135
return false;
127136
});
128137

129-
// Make a regular request without the vercel-cron user agent
130138
const response = await request.get('/api/cron-test');
131139

132140
expect(response.status()).toBe(200);
133141
expect(await response.json()).toStrictEqual({ message: 'Cron job executed successfully' });
134142

135-
// Wait a bit to ensure no check-in is sent
136143
await new Promise(resolve => setTimeout(resolve, 2000));
137144

138145
expect(checkInReceived).toBe(false);

dev-packages/e2e-tests/test-applications/nextjs-16/tests/vercel-cron-monitoring.test.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@ test('Sends cron check-in envelope for successful cron job', async ({ request })
55
const inProgressEnvelopePromise = waitForEnvelopeItem('nextjs-16', envelope => {
66
return (
77
envelope[0].type === 'check_in' &&
8+
// @ts-expect-error envelope[1] is untyped
89
envelope[1]['monitor_slug'] === '/api/cron-test' &&
10+
// @ts-expect-error envelope[1] is untyped
911
envelope[1]['status'] === 'in_progress'
1012
);
1113
});
1214

1315
const okEnvelopePromise = waitForEnvelopeItem('nextjs-16', envelope => {
1416
return (
1517
envelope[0].type === 'check_in' &&
18+
// @ts-expect-error envelope[1] is untyped
1619
envelope[1]['monitor_slug'] === '/api/cron-test' &&
20+
// @ts-expect-error envelope[1] is untyped
1721
envelope[1]['status'] === 'ok'
1822
);
1923
});
2024

21-
// Simulate Vercel cron request with the special user agent
2225
const response = await request.get('/api/cron-test', {
2326
headers: {
2427
'User-Agent': 'vercel-cron/1.0',
@@ -55,28 +58,31 @@ test('Sends cron check-in envelope for successful cron job', async ({ request })
5558
}),
5659
);
5760

58-
// Check-in IDs should match
61+
// @ts-expect-error envelope[1] is untyped
5962
expect(okEnvelope[1]['check_in_id']).toBe(inProgressEnvelope[1]['check_in_id']);
6063
});
6164

6265
test('Sends cron check-in envelope with error status for failed cron job', async ({ request }) => {
6366
const inProgressEnvelopePromise = waitForEnvelopeItem('nextjs-16', envelope => {
6467
return (
6568
envelope[0].type === 'check_in' &&
69+
// @ts-expect-error envelope[1] is untyped
6670
envelope[1]['monitor_slug'] === '/api/cron-test-error' &&
71+
// @ts-expect-error envelope[1] is untyped
6772
envelope[1]['status'] === 'in_progress'
6873
);
6974
});
7075

7176
const errorEnvelopePromise = waitForEnvelopeItem('nextjs-16', envelope => {
7277
return (
7378
envelope[0].type === 'check_in' &&
79+
// @ts-expect-error envelope[1] is untyped
7480
envelope[1]['monitor_slug'] === '/api/cron-test-error' &&
81+
// @ts-expect-error envelope[1] is untyped
7582
envelope[1]['status'] === 'error'
7683
);
7784
});
7885

79-
// Simulate Vercel cron request with the special user agent
8086
await request.get('/api/cron-test-error', {
8187
headers: {
8288
'User-Agent': 'vercel-cron/1.0',
@@ -110,29 +116,31 @@ test('Sends cron check-in envelope with error status for failed cron job', async
110116
}),
111117
);
112118

113-
// Check-in IDs should match
119+
// @ts-expect-error envelope[1] is untyped
114120
expect(errorEnvelope[1]['check_in_id']).toBe(inProgressEnvelope[1]['check_in_id']);
115121
});
116122

117-
test('Does not send cron check-in envelope for regular requests without vercel-cron user agent', async ({ request }) => {
118-
// Use a flag to track if any check-in envelope is received
123+
test('Does not send cron check-in envelope for regular requests without vercel-cron user agent', async ({
124+
request,
125+
}) => {
119126
let checkInReceived = false;
120127

121-
const checkInPromise = waitForEnvelopeItem('nextjs-16', envelope => {
122-
if (envelope[0].type === 'check_in' && envelope[1]['monitor_slug'] === '/api/cron-test') {
128+
waitForEnvelopeItem('nextjs-16', envelope => {
129+
if (
130+
envelope[0].type === 'check_in' && // @ts-expect-error envelope[1] is untyped
131+
envelope[1]['monitor_slug'] === '/api/cron-test'
132+
) {
123133
checkInReceived = true;
124134
return true;
125135
}
126136
return false;
127137
});
128138

129-
// Make a regular request without the vercel-cron user agent
130139
const response = await request.get('/api/cron-test');
131140

132141
expect(response.status()).toBe(200);
133142
expect(await response.json()).toStrictEqual({ message: 'Cron job executed successfully' });
134143

135-
// Wait a bit to ensure no check-in is sent
136144
await new Promise(resolve => setTimeout(resolve, 2000));
137145

138146
expect(checkInReceived).toBe(false);

0 commit comments

Comments
 (0)