Skip to content

Commit

Permalink
chore(tests): Remove unnecessary mock of console.warn
Browse files Browse the repository at this point in the history
  • Loading branch information
freakzlike committed May 17, 2023
1 parent d56cce2 commit 74cfec9
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions tests/emit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { describe, expect, it } from 'vitest'
import {
defineComponent,
FunctionalComponent,
Expand All @@ -13,17 +13,6 @@ import EmitsEventScriptSetup from './components/EmitsEventScriptSetup.vue'
import { mount } from '../src'

describe('emitted', () => {
let consoleWarnSave = console.info

beforeEach(() => {
consoleWarnSave = console.warn
console.warn = vi.fn()
})

afterEach(() => {
console.warn = consoleWarnSave
})

it('captures events emitted via this.$emit', async () => {
const Component = defineComponent({
render() {
Expand Down Expand Up @@ -269,7 +258,8 @@ describe('emitted', () => {
const Comp = {
setup(_: Record<string, any>, { emit }: { emit: SetupContext['emit'] }) {
emit('foo')
}
},
template: '<div/>'
}
const wrapper = mount(Comp)
expect(wrapper.emitted().foo).toBeTruthy()
Expand Down

0 comments on commit 74cfec9

Please sign in to comment.