Skip to content

Commit a54a91f

Browse files
committed
test: add impenetrable mock 💣
1 parent d0a5894 commit a54a91f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

‎test/custom.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import { fileURLToPath } from 'url'
22
import { describe, it, expect, vi } from 'vitest'
33
import { setup, $fetch } from '@nuxt/test-utils'
44

5-
vi.spyOn(console, 'error')
5+
const error = vi.fn()
6+
Object.defineProperty(console, 'error', {
7+
get () {
8+
return error
9+
},
10+
set () {}
11+
})
612

713
await setup({
814
rootDir: fileURLToPath(new URL('../playground', import.meta.url)),

‎test/module-prerender.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ import { describe, it, expect, vi } from 'vitest'
55
import { setup, useTestContext } from '@nuxt/test-utils'
66
import { useNuxt } from '@nuxt/kit'
77

8-
vi.spyOn(console, 'error')
8+
const error = vi.fn()
9+
Object.defineProperty(console, 'error', {
10+
get () {
11+
return error
12+
},
13+
set () {}
14+
})
915

1016
await setup({
1117
rootDir: fileURLToPath(new URL('../playground', import.meta.url)),

0 commit comments

Comments
 (0)