Closed igorzi closed 10 months ago
I would like to handle this issue if it's okay by you. Still a beginner to open source though but I feel like I can try it out
While I wait to be assigned to this issue, I'd like to say I am currently working on this for anyone who might want to hop on as well. Thanks
Thanks @Cedar-81
Quick questions can you give more information about the schedule string, you've stated that it can accept minute, hour, date_of_week, but there are 2 asterisks left. If there is any resource I can use to understand the schedule string better it would be really helpful cause I'd need to reconstruct the schedule string from the passed in object so I need to understand its format.
It's a standard cron schedule string. See https://en.wikipedia.org/wiki/Cron.
okay, thanks.
on a side note there is a npm package which helps to abstract that string: https://www.npmjs.com/package/cron-time-generator
I want to pick this task @igorzi.
Where exactly are we writing test cases for corn?
Sounds good, @raashidanwar! Please check with @Cedar-81.
Current cron tests are here: https://github.com/denoland/deno/blob/main/cli/tests/unit/cron_test.ts
Sorry for not attending to this for so long, funny enough I have actually implemented this but I couldnt run tests because I had some problems setting up Rust and according to the Docs I needed to run all tests.
Feel free to go ahead as I am currently swamped with some other tasks. Thanks a lot for this opportunity and sorry again for not reaching out for so long.
Hi @igorzi 👋 .
Here is the draft PR https://github.com/denoland/deno/pull/21340. Do have a look.
I tried writing the test cases, but when I am running it using ./target/debug/deno test --unstable --allow-env cli/tests/unit/cron_test.ts
somehow, it gave a type error that only string is expected, but I have tested it with a dummy code, and it is correctly parsing the JSON.
would be glad if you could help it the test case issue.
@igorzi I added the test cases. Do have a look at PR https://github.com/denoland/deno/pull/21340.
Currently
Deno.cron()
2nd argument is a string, which specifies the schedule using the cron format.We'd like to extend this with a JS-friendly API, which allows the schedule to be specified using Javascript object literals. The conversion should happen in https://github.com/denoland/deno/blob/main/ext/cron/01_cron.ts.
Here are some examples:
Exact
becomes:
Every nth
becomes:
List of schedules
becomes: