File tree Expand file tree Collapse file tree 6 files changed +74
-3
lines changed 
dev-packages/node-integration-tests Expand file tree Collapse file tree 6 files changed +74
-3
lines changed Original file line number Diff line number Diff line change 3636    "apollo-server" : " ^3.11.1" 
3737    "axios" : " ^0.27.2" 
3838    "cors" : " ^2.8.5" 
39+     "cron" : " ^3.1.6" 
3940    "express" : " ^4.17.3" 
4041    "graphql" : " ^16.3.0" 
4142    "http-terminator" : " ^3.2.0" 
Original file line number Diff line number Diff line change 1+ import  *  as  Sentry  from  '@sentry/node' ; 
2+ import  {  CronJob  }  from  'cron' ; 
3+ 
4+ // eslint-disable-next-line @typescript-eslint/no-unused-vars 
5+ const  CronJobWithCheckIn  =  Sentry . cron . instrumentCron ( CronJob ,  'my-cron-job' ) ; 
6+ 
7+ setTimeout ( ( )  =>  { 
8+   process . exit ( 0 ) ; 
9+ } ,  1_000 ) ; 
Original file line number Diff line number Diff line change 1+ import  {  cleanupChildProcesses ,  createRunner  }  from  '../../../utils/runner' ; 
2+ 
3+ afterAll ( ( )  =>  { 
4+   cleanupChildProcesses ( ) ; 
5+ } ) ; 
6+ 
7+ test ( 'node-cron types should match' ,  done  =>  { 
8+   createRunner ( __dirname ,  'scenario.ts' ) . ensureNoErrorOutput ( ) . start ( done ) ; 
9+ } ) ; 
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ export function createRunner(...paths: string[]) {
7070  const  flags : string [ ]  =  [ ] ; 
7171  const  ignored : EnvelopeItemType [ ]  =  [ ] ; 
7272  let  withSentryServer  =  false ; 
73+   let  ensureNoErrorOutput  =  false ; 
7374
7475  if  ( testPath . endsWith ( '.ts' ) )  { 
7576    flags . push ( '-r' ,  'ts-node/register' ) ; 
@@ -92,6 +93,10 @@ export function createRunner(...paths: string[]) {
9293      ignored . push ( ...types ) ; 
9394      return  this ; 
9495    } , 
96+     ensureNoErrorOutput : function  ( )  { 
97+       ensureNoErrorOutput  =  true ; 
98+       return  this ; 
99+     } , 
95100    start : function  ( done ?: ( e ?: unknown )  =>  void )  { 
96101      const  expectedEnvelopeCount  =  expectedEnvelopes . length ; 
97102
@@ -190,8 +195,19 @@ export function createRunner(...paths: string[]) {
190195
191196        CHILD_PROCESSES . add ( child ) ; 
192197
198+         if  ( ensureNoErrorOutput )  { 
199+           child . stderr . on ( 'data' ,  ( data : Buffer )  =>  { 
200+             const  output  =  data . toString ( ) ; 
201+             complete ( new  Error ( `Expected no error output but got: '${ output }  ) ) ; 
202+           } ) ; 
203+         } 
204+ 
193205        child . on ( 'close' ,  ( )  =>  { 
194206          hasExited  =  true ; 
207+ 
208+           if  ( ensureNoErrorOutput )  { 
209+             complete ( ) ; 
210+           } 
195211        } ) ; 
196212
197213        // Pass error to done to end the test quickly 
Original file line number Diff line number Diff line change @@ -8,10 +8,17 @@ export type CronJobParams = {
88  start ?: boolean  |  null ; 
99  context ?: unknown ; 
1010  runOnInit ?: boolean  |  null ; 
11-   utcOffset ?: number ; 
12-   timeZone ?: string ; 
1311  unrefTimeout ?: boolean  |  null ; 
14- } ; 
12+ }  &  ( 
13+   |  { 
14+       timeZone ?: string  |  null ; 
15+       utcOffset ?: never ; 
16+     } 
17+   |  { 
18+       timeZone ?: never ; 
19+       utcOffset ?: number  |  null ; 
20+     } 
21+ ) ; 
1522
1623export  type  CronJob  =  { 
1724  // 
@@ -28,6 +35,17 @@ export type CronJobConstructor = {
2835    timeZone ?: CronJobParams [ 'timeZone' ] , 
2936    context ?: CronJobParams [ 'context' ] , 
3037    runOnInit ?: CronJobParams [ 'runOnInit' ] , 
38+     utcOffset ?: null , 
39+     unrefTimeout ?: CronJobParams [ 'unrefTimeout' ] , 
40+   ) : CronJob ; 
41+   new  ( 
42+     cronTime : CronJobParams [ 'cronTime' ] , 
43+     onTick : CronJobParams [ 'onTick' ] , 
44+     onComplete ?: CronJobParams [ 'onComplete' ] , 
45+     start ?: CronJobParams [ 'start' ] , 
46+     timeZone ?: null , 
47+     context ?: CronJobParams [ 'context' ] , 
48+     runOnInit ?: CronJobParams [ 'runOnInit' ] , 
3149    utcOffset ?: CronJobParams [ 'utcOffset' ] , 
3250    unrefTimeout ?: CronJobParams [ 'unrefTimeout' ] , 
3351  ) : CronJob ; 
Original file line number Diff line number Diff line change 62686268  resolved "https://registry.yarnpkg.com/@types/lru-cache/-/lru-cache-5.1.0.tgz#57f228f2b80c046b4a1bd5cac031f81f207f4f03"
62696269  integrity sha512-RaE0B+14ToE4l6UqdarKPnXwVDuigfFv+5j9Dze/Nqr23yyuqdNvzcZi3xB+3Agvi5R4EOgAksfv3lXX4vBt9w==
62706270
6271+ "@types/luxon@~3.3.0":
6272+   version "3.3.8"
6273+   resolved "https://registry.yarnpkg.com/@types/luxon/-/luxon-3.3.8.tgz#84dbf2d020a9209a272058725e168f21d331a67e"
6274+   integrity sha512-jYvz8UMLDgy3a5SkGJne8H7VA7zPV2Lwohjx0V8V31+SqAjNmurWMkk9cQhfvlcnXWudBpK9xPM1n4rljOcHYQ==
6275+ 
6271627662726277  version "2.1.33"
62736278  resolved "https://registry.yarnpkg.com/@types/md5/-/md5-2.1.33.tgz#8c8dba30df4ad0e92296424f08c4898dd808e8df"
1194711952    postcss "^8.3.7"
1194811953    pretty-bytes "^5.3.0"
1194911954
11955+ cron@^3.1.6:
11956+   version "3.1.6"
11957+   resolved "https://registry.yarnpkg.com/cron/-/cron-3.1.6.tgz#e7e1798a468e017c8d31459ecd7c2d088f97346c"
11958+   integrity sha512-cvFiQCeVzsA+QPM6fhjBtlKGij7tLLISnTSvFxVdnFGLdz+ZdXN37kNe0i2gefmdD17XuZA6n2uPVwzl4FxW/w==
11959+   dependencies:
11960+     "@types/luxon" "~3.3.0"
11961+     luxon "~3.4.0"
11962+ 
1195011963cross-spawn@^6.0.0, cross-spawn@^6.0.5:
1195111964  version "6.0.5"
1195211965  resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
@@ -20696,6 +20709,11 @@ lunr@^2.3.8:
2069620709  resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1"
2069720710  integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==
2069820711
20712+ luxon@~3.4.0:
20713+   version "3.4.4"
20714+   resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.4.4.tgz#cf20dc27dc532ba41a169c43fdcc0063601577af"
20715+   integrity sha512-zobTr7akeGHnv7eBOXcRgMeCP6+uyYsczwmeRCauvpvaAltgNyTbLH/+VaEAPUeWBT+1GuNmz4wC/6jtQzbbVA==
20716+ 
2069920717lz-string@^1.4.4:
2070020718  version "1.4.4"
2070120719  resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26"
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments