nimiq / qr-scanner

Lightweight Javascript QR Code Scanner
https://nimiq.github.io/qr-scanner/demo
MIT License
2.35k stars 509 forks source link

"window is not defined" error when writing tests #246

Open hems opened 8 months ago

hems commented 8 months ago

I'm writing a test to check an API endpoint and unfortunately i'm getting that error when trying to use qr-scanner on the backend.

Here is an example piece of code that i'm running inside of a jest test:

    const qrCodeText = await QrScanner.scanImage(res.body);