cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.56k stars 659 forks source link

🐛 BUG: jest-image-snapshot is not work with the new vitest integration #5605

Open ducan-ne opened 4 months ago

ducan-ne commented 4 months ago

Which Cloudflare product(s) does this pertain to?

Workers Vitest Integration

What version(s) of the tool(s) are you using?

"@cloudflare/vitest-pool-workers": "^0.1.19", "wrangler": "3.37.0"

What version of Node are you using?

20.12.1

What operating system and version are you using?

Mac Sonoma 14

Describe the Bug

Observed behavior

I want to test if my image response from worker is valid or not but couldn't make it work with jest-image-snapshot, AFAIK it's the only solution for image snapshot https://vitest.dev/guide/snapshot#image-snapshots

The error I got

Error: No such module "node:child_process".

Expected behavior

It should works like the default setting of vitest

Steps to reproduce

Please provide the following:

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

vladinator1000 commented 4 months ago

I encountered a similar bug when importing stuff from zx:

import { glob, fs, path } from 'zx'
Error: No such module "node:child_process".
  imported from "home/vlady/code/yupty/api/node_modules/zx/build/core.js"