diff --git a/src/__tests__/auto-cleanup-vitest-globals.js b/src/__tests__/auto-cleanup-vitest-globals.js deleted file mode 100644 index 8d320ea..0000000 --- a/src/__tests__/auto-cleanup-vitest-globals.js +++ /dev/null @@ -1,7 +0,0 @@ -// This test verifies that if test is running from vitest with globals - jest will not throw -test('works', () => { - global.afterEach = () => {} // emulate enabled globals - process.env.VITEST = 'true' - - expect(() => require('..')).not.toThrow() -}) diff --git a/src/__tests__/auto-cleanup-vitest.js b/src/__tests__/auto-cleanup-vitest.js deleted file mode 100644 index ef0a5a1..0000000 --- a/src/__tests__/auto-cleanup-vitest.js +++ /dev/null @@ -1,10 +0,0 @@ -// This test verifies that if test is running from vitest without globals - jest will throw -test('works', () => { - delete global.afterEach // no globals in vitest by default - process.env.VITEST = 'true' - - expect(() => require('..')).toThrowErrorMatchingInlineSnapshot(` - You are using vitest without globals, this way we can't run cleanup after each test. - See https://testing-library.com/docs/vue-testing-library/setup for details or set the VTL_SKIP_AUTO_CLEANUP variable to 'true' - `) -}) diff --git a/src/index.js b/src/index.js index 99a01b7..b9f4dc4 100644 --- a/src/index.js +++ b/src/index.js @@ -8,11 +8,6 @@ if (typeof afterEach === 'function' && !process.env.VTL_SKIP_AUTO_CLEANUP) { afterEach(() => { cleanup() }) -} else if (process.env.VITEST === 'true') { - throw new Error( - "You are using vitest without globals, this way we can't run cleanup after each test.\n" + - "See https://testing-library.com/docs/vue-testing-library/setup for details or set the VTL_SKIP_AUTO_CLEANUP variable to 'true'", - ) } export * from '@testing-library/dom'