From 5990e1407aba88a66c57cfb11e86e63eab3015aa Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 3 Dec 2024 20:35:51 +0000 Subject: [PATCH] fix(vitest-environment): suppress suspense warning (#1026) --- src/environments/vitest/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/environments/vitest/index.ts b/src/environments/vitest/index.ts index 73d58f79d..634283a04 100644 --- a/src/environments/vitest/index.ts +++ b/src/environments/vitest/index.ts @@ -25,6 +25,14 @@ export default { environmentOptions?.nuxtRuntimeConfig.app?.baseURL || '/', ) + const consoleInfo = console.info + console.info = (...args) => { + if (args[0] === ' 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, { @@ -150,6 +158,7 @@ export default { 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() },