Skip to content

Commit 7d9e23e

Browse files
AbhiPrasadc298lee
authored andcommitted
fix(cron): Make name required for instrumentNodeCron option (#10070)
This should enforce via TypeScript that users pass in a name, but we can keep the runtime check just in case.
1 parent 843f68e commit 7d9e23e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/node/src/cron/node-cron.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { withMonitor } from '@sentry/core';
22
import { replaceCronNames } from './common';
33

44
export interface NodeCronOptions {
5-
name?: string;
5+
name: string;
66
timezone?: string;
77
}
88

99
export interface NodeCron {
10-
schedule: (cronExpression: string, callback: () => void, options?: NodeCronOptions) => unknown;
10+
schedule: (cronExpression: string, callback: () => void, options: NodeCronOptions) => unknown;
1111
}
1212

1313
/**

packages/node/test/cron.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ describe('cron check-ins', () => {
118118
const cronWithCheckIn = cron.instrumentNodeCron(nodeCron);
119119

120120
expect(() => {
121+
// @ts-expect-error Initially missing name
121122
cronWithCheckIn.schedule('* * * * *', () => {
122123
//
123124
});

0 commit comments

Comments
 (0)