Skip to content

Commit c5482b4

Browse files
committed
fix: use await in test
Removes the warning: ``` stderr | tests/trigger.spec.ts > trigger > errors > throws error if options contains a target value Promise returned by `expect(actual).rejects.toThrowError(expected)` was not awaited. Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. Please remember to await the assertion. ```
1 parent cd91d1f commit c5482b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/trigger.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ describe('trigger', () => {
344344
})
345345

346346
describe('errors', () => {
347-
it('throws error if options contains a target value', () => {
347+
it('throws error if options contains a target value', async () => {
348348
const expectedErrorMessage =
349349
'[vue-test-utils]: you cannot set the target value of an event. See the notes section of the docs for more details—https://vue-test-utils.vuejs.org/api/wrapper/trigger.html'
350350

@@ -356,7 +356,7 @@ describe('trigger', () => {
356356
const wrapper = mount(Component, {})
357357

358358
const fn = wrapper.trigger('click', { target: 'something' })
359-
expect(fn).rejects.toThrowError(expectedErrorMessage)
359+
await expect(fn).rejects.toThrowError(expectedErrorMessage)
360360

361361
expect(clickHandler).not.toHaveBeenCalled()
362362
})

0 commit comments

Comments
 (0)