How to correctly setup Miniflare & Miniflare Jest Testing with a Cloudflare Worker on GitHub Actions

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
DaniFoldi
DaniFoldiā€¢12mo ago
does it work locally? I see you have an ancient node version specified, miniflare needs at least 16.13.0
sadisticautism
sadisticautismā€¢12mo ago
Negatory, will update that now see if it helps. Failing up to: Run npm run miniflare &
worker-typescript-template@1.0.0 miniflare npx miniflare ../src/index.ts
npm 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
DaniFoldi
DaniFoldiā€¢12mo ago
as indicated by the error, you're missing a script called test
sadisticautism
sadisticautismā€¢12mo ago
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"