Skip to content

Commit

Permalink
fix(vitest-environment): suppress suspense warning (#1026)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Dec 3, 2024
1 parent 302053c commit 5990e14
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/environments/vitest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ export default <Environment>{
environmentOptions?.nuxtRuntimeConfig.app?.baseURL || '/',
)

const consoleInfo = console.info
console.info = (...args) => {
if (args[0] === '<Suspense> is an experimental feature and its API will likely change.') {
return
}
return consoleInfo(...args)
}

const environmentName = environmentOptions.nuxt.domEnvironment as NuxtBuiltinEnvironment
const environment = environmentMap[environmentName] || environmentMap['happy-dom']
const { window: win, teardown } = await environment(global, defu(environmentOptions, {
Expand Down Expand Up @@ -150,6 +158,7 @@ export default <Environment>{
teardown() {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
keys.forEach(key => delete global[key])
console.info = consoleInfo
originals.forEach((v, k) => (global[k] = v))
teardown()
},
Expand Down

0 comments on commit 5990e14

Please sign in to comment.