Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): Remove unnecessary mock of console.warn #2056

Merged
merged 1 commit into from May 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 3 additions & 13 deletions tests/emit.spec.ts
@@ -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