workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

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

Open ducan-ne opened this issue 1 year ago • 2 comments

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:

  • A simple worker return image
  • install jest-image-snapshot
  • extend the matcher with expect.extend({ toMatchImageSnapshot })
  • Run test

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

ducan-ne avatar Apr 12 '24 17:04 ducan-ne