File tree Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -143,5 +143,35 @@ Array [
143
143
" task" : " with_key_and_mode" ,
144
144
Symbol (isParsed ): true ,
145
145
} ,
146
+ Object {
147
+ " identifier" : " nested/task" ,
148
+ " match" : [Function ],
149
+ " options" : Object {
150
+ " backfillPeriod" : 0 ,
151
+ " jobKey" : " my_key" ,
152
+ " jobKeyMode" : " preserve_run_at" ,
153
+ " maxAttempts" : undefined ,
154
+ " priority" : undefined ,
155
+ " queueName" : undefined ,
156
+ },
157
+ " payload" : null ,
158
+ " task" : " nested/task" ,
159
+ Symbol (isParsed ): true ,
160
+ } ,
161
+ Object {
162
+ " identifier" : " nested/folder/task" ,
163
+ " match" : [Function ],
164
+ " options" : Object {
165
+ " backfillPeriod" : 0 ,
166
+ " jobKey" : " my_key" ,
167
+ " jobKeyMode" : " preserve_run_at" ,
168
+ " maxAttempts" : undefined ,
169
+ " priority" : undefined ,
170
+ " queueName" : undefined ,
171
+ },
172
+ " payload" : null ,
173
+ " task" : " nested/folder/task" ,
174
+ Symbol (isParsed ): true ,
175
+ } ,
146
176
]
147
177
` ;
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ test("parses crontab file correctly", () => {
44
44
* * * * * lots_of_spaces
45
45
* * * * * with_key ?jobKey=my_key
46
46
* * * * * with_key_and_mode ?jobKey=my_key&jobKeyMode=preserve_run_at
47
+ * * * * * nested/task ?jobKey=my_key&jobKeyMode=preserve_run_at
48
+ * * * * * nested/folder/task ?jobKey=my_key&jobKeyMode=preserve_run_at
47
49
` ;
48
50
const parsed = parseCrontab ( exampleCrontab ) ;
49
51
@@ -173,6 +175,20 @@ test("parses crontab file correctly", () => {
173
175
} ) ;
174
176
expect ( parsed [ 8 ] . payload ) . toEqual ( null ) ;
175
177
178
+ expect ( parsed [ 9 ] . task ) . toEqual ( "nested/task" ) ;
179
+ expect ( parsed [ 9 ] . identifier ) . toEqual ( "nested/task" ) ;
180
+ const parsedCronMatch9 = ( parsed [ 9 ] . match as any )
181
+ . parsedCronMatch as ParsedCronMatch ;
182
+ expect ( parsedCronMatch9 . minutes ) . toEqual ( ALL_MINUTES ) ;
183
+ expect ( parsedCronMatch9 . hours ) . toEqual ( ALL_HOURS ) ;
184
+
185
+ expect ( parsed [ 10 ] . task ) . toEqual ( "nested/folder/task" ) ;
186
+ expect ( parsed [ 10 ] . identifier ) . toEqual ( "nested/folder/task" ) ;
187
+ const parsedCronMatch10 = ( parsed [ 10 ] . match as any )
188
+ . parsedCronMatch as ParsedCronMatch ;
189
+ expect ( parsedCronMatch10 . minutes ) . toEqual ( ALL_MINUTES ) ;
190
+ expect ( parsedCronMatch10 . hours ) . toEqual ( ALL_HOURS ) ;
191
+
176
192
expect ( parsed ) . toMatchSnapshot ( ) ;
177
193
} ) ;
178
194
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export const CRONTAB_WILDCARD = /^\*(?:\/([0-9]+))?$/;
28
28
// The command from the crontab line
29
29
/** Splits the command from the crontab line into the task, options and payload. */
30
30
export const CRONTAB_COMMAND =
31
- / ^ ( [ _ a - z A - Z ] [ _ a - z A - Z 0 - 9 : _ - ] * ) (?: \s + \? ( [ ^ \s ] + ) ) ? (?: \s + ( \{ .* \} ) ) ? $ / ;
31
+ / ^ ( [ _ a - z A - Z ] [ _ a - z A - Z 0 - 9 : \/ _ - ] * ) (?: \s + \? ( [ ^ \s ] + ) ) ? (?: \s + ( \{ .* \} ) ) ? $ /
32
32
33
33
// Crontab command options
34
34
/** Matches the id=UID option, capturing the unique identifier */
You can’t perform that action at this time.
0 commit comments