jonast
jonast
CDCloudflare Developers
Created by jonast on 5/21/2025 in #vitest-integration-beta
GitHub - iterate-com/cf-vitest-repro
Simple repro of vitest and workers.

In src/workers we have cloudflare specific code with the corresponding tests.

We have a vitest workspace setup to target only this directory.

In src/lib we have Node.js code. The vitest workspace node is setup to target this, but not the workers directory.

Run pnpm vitest - see error:

FAIL workers src/workers/index.test.ts [ src/workers/index.test.ts ]
SyntaxError: The requested module 'node:fs' does not provide an export named 'ReadStream'
Remove the openai usage in src/workers/index.ts. Then re-run the tests:

[vpw:inf] Starting isolated runtimes for 0...
✓ node src/lib/greet.test.ts (1 test) 3ms
✓ workers src/workers/index.test.ts (1 test) 6ms
It works!
Simple repro of vitest and workers.

In src/workers we have cloudflare specific code with the corresponding tests.

We have a vitest workspace setup to target only this directory.

In src/lib we have Node.js code. The vitest workspace node is setup to target this, but not the workers directory.

Run pnpm vitest - see error:

FAIL workers src/workers/index.test.ts [ src/workers/index.test.ts ]
SyntaxError: The requested module 'node:fs' does not provide an export named 'ReadStream'
Remove the openai usage in src/workers/index.ts. Then re-run the tests:

[vpw:inf] Starting isolated runtimes for 0...
✓ node src/lib/greet.test.ts (1 test) 3ms
✓ workers src/workers/index.test.ts (1 test) 6ms
It works!
1 replies
CDCloudflare Developers
Created by jonast on 5/21/2025 in #workers-and-pages-discussions
👋 I've got a simple list of schedules
So only * * * * * is poison
9 replies
CDCloudflare Developers
Created by jonast on 5/21/2025 in #workers-and-pages-discussions
👋 I've got a simple list of schedules
Works
9 replies
CDCloudflare Developers
Created by jonast on 5/21/2025 in #workers-and-pages-discussions
👋 I've got a simple list of schedules
Good shout - am trying it now
9 replies
CDCloudflare Developers
Created by jonast on 5/21/2025 in #workers-and-pages-discussions
👋 I've got a simple list of schedules
A bug nonetheless. Where best to file this?
9 replies
CDCloudflare Developers
Created by jonast on 5/21/2025 in #workers-and-pages-discussions
👋 I've got a simple list of schedules
Okay, so a less severe bug 😌
9 replies
CDCloudflare Developers
Created by jonast on 5/21/2025 in #workers-and-pages-discussions
👋 I've got a simple list of schedules
Note the /2 and /4 firing separately at the same time
9 replies
CDCloudflare Developers
Created by jonast on 5/21/2025 in #workers-and-pages-discussions
👋 I've got a simple list of schedules
No description
9 replies
CDCloudflare Developers
Created by jonast on 5/21/2025 in #workers-and-pages-discussions
👋 I've got a simple list of schedules
Oh wait, this behaviour ONLY seems to happen when using * * * * *
9 replies
CDCloudflare Developers
Created by jonast on 5/21/2025 in #workers-and-pages-discussions
👋 I've got a simple list of schedules
I believe this means the example from the docs here doesn't work either? https://developers.cloudflare.com/workers/examples/multiple-cron-triggers/
switch (controller.cron) {
case "*/3 * * * *":
// Every three minutes
await updateAPI();
break;
case "*/10 * * * *":
// Every ten minutes
await updateAPI2();
break;
case "*/45 * * * *":
// Every forty-five minutes
await updateAPI3();
break;
}
switch (controller.cron) {
case "*/3 * * * *":
// Every three minutes
await updateAPI();
break;
case "*/10 * * * *":
// Every ten minutes
await updateAPI2();
break;
case "*/45 * * * *":
// Every forty-five minutes
await updateAPI3();
break;
}
Because 45 is divisible by 3, controller.cron would never match the third case
9 replies
TtRPC
Created by jonast on 12/16/2024 in #❓-help
Getting nitro adapter to work
Solved it. Removed trpc/
2 replies