How to correctly setup Miniflare & Miniflare Jest Testing with a Cloudflare Worker on GitHub Actions
https://stackoverflow.com/questions/76550495/how-to-correctly-setup-miniflare-miniflare-jest-testing-with-a-cloudflare-work
Please see SO for more details 🙂
Stack Overflow
How to correctly setup Miniflare & Miniflare Jest Testing with a Cl...
I am really struggling to correctly setup a Miniflare Enviroment with a Cloudflare Worker on GitHub Actions so I can use Miniflare Jest to perform Jest testing.
So far, I have followed the guides
4 Replies
does it work locally?
I see you have an ancient node version specified, miniflare needs at least
16.13.0
Negatory, will update that now see if it helps.
Failing up to:
Run npm run miniflare &
[email protected] miniflare npx miniflare ../src/index.tsnpm ERR! could not determine executable to run npm ERR! A complete log of this run can be found in: npm ERR! /home/runner/.npm/_logs/2023-06-25T14_10_26_499Z-debug-0.log npm ERR! Missing script: "test" npm ERR! npm ERR! To see a list of scripts, run: npm ERR! npm run npm ERR! A complete log of this run can be found in: npm ERR! /home/runner/.npm/_logs/2023-06-25T14_10_31_205Z-debug-0.log Error: Process completed with exit code 1. All packages are supported on 18
as indicated by the error, you're missing a script called
test
Getting closer, export default {
SyntaxError: Unexpected token 'export'
Just enable "type":"module"?
Sorted that issue, now I'm getting: ENOENT: no such file or directory, open '/home/runner/work/edge/edge/dist/worker.js'
should be? ./dist/index.mjs"