From 5f7b955fdf815242d60e06422ae194d31474c694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Exbrayat?= Date: Sat, 3 Sep 2022 09:51:04 +0200 Subject: [PATCH] chore: run tests in random order This fixes issues of some tests relying on others to run first. --- tests/features/compat.spec.ts | 6 ++++++ tests/features/suspense.spec.ts | 6 +++++- tests/mountingOptions/global.stubs.spec.ts | 10 +++++----- vitest.config.ts | 3 +++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/tests/features/compat.spec.ts b/tests/features/compat.spec.ts index 36184df5d..92bf28ddf 100644 --- a/tests/features/compat.spec.ts +++ b/tests/features/compat.spec.ts @@ -165,6 +165,12 @@ describe('@vue/compat build', () => { }) it('wrapper.vm points to correct instance when component is wrapped with Vue.extend', () => { + configureCompat({ + MODE: 3, + GLOBAL_EXTEND: 'suppress-warning', + GLOBAL_MOUNT: 'suppress-warning' + }) + const Component = extend({ data() { return { foo: 'bar' } diff --git a/tests/features/suspense.spec.ts b/tests/features/suspense.spec.ts index 3739efcf9..d497bb80c 100644 --- a/tests/features/suspense.spec.ts +++ b/tests/features/suspense.spec.ts @@ -1,4 +1,4 @@ -import { describe, expect, test, vi } from 'vitest' +import { beforeEach, describe, expect, test, vi } from 'vitest' import SuspenseComponent from '../components/Suspense.vue' import { mount, flushPromises } from '../../src' import { defineComponent } from 'vue' @@ -12,6 +12,10 @@ vi.mock('../utils', () => ({ } })) +beforeEach(() => { + mockShouldError = false +}) + describe('suspense', () => { test('fallback state', () => { const wrapper = mount(SuspenseComponent) diff --git a/tests/mountingOptions/global.stubs.spec.ts b/tests/mountingOptions/global.stubs.spec.ts index bd90bb264..c97f51038 100644 --- a/tests/mountingOptions/global.stubs.spec.ts +++ b/tests/mountingOptions/global.stubs.spec.ts @@ -395,19 +395,19 @@ describe('mounting options: stubs', () => { describe('transition', () => { it('stubs transition by default', () => { - const Comp = { - template: `
` + const CompStubbedByDefault = { + template: `
` } - const wrapper = mount(Comp) + const wrapper = mount(CompStubbedByDefault) expect(wrapper.html()).toBe( '\n' + - '
\n' + + '
\n' + '
' ) }) - it('opts out of stubbing transition by default', () => { + it('opts out of stubbing transition', () => { const Comp = { template: `
` } diff --git a/vitest.config.ts b/vitest.config.ts index 494b9a80a..d02490881 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -16,6 +16,9 @@ export default defineConfig({ include: ['tests/**/*.spec.ts'], deps: { inline: ['vue', '@vue/compat'] + }, + sequence: { + shuffle: true } }, resolve: {