IanVS / vitest-fetch-mock

Vitest mock for fetch, forked from jest-fetch-mock
MIT License
59 stars 7 forks source link

Wrap await with async #16

Closed pulzarraider closed 10 months ago

pulzarraider commented 10 months ago

With wrapping the await can be this code used in tests in real browser. Without this it cause error: Top-level await is not available in the configured target environment...

IanVS commented 10 months ago

What browser are you using? From the MDN docs, it seems modern browsers support top-level await already: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#browser_compatibility

pulzarraider commented 10 months ago

Your're right. Seems I have some configuration issue with vite My build target option is ignored and the default module (['es2020', 'edge88', 'firefox78', 'chrome87', 'safari14']) is used instead.

Closing as it is not problem of this library,