From dceeb57cdec44a85889543f96697fcc7d714ef55 Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Tue, 15 Oct 2024 14:37:52 +0200 Subject: [PATCH 1/3] fix(browser): don't polyfill process.env --- packages/browser/src/node/plugin.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/packages/browser/src/node/plugin.ts b/packages/browser/src/node/plugin.ts index 524fb9bf3307..6fde2c4449a4 100644 --- a/packages/browser/src/node/plugin.ts +++ b/packages/browser/src/node/plugin.ts @@ -388,24 +388,10 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { } }, }, - // TODO: remove this when @testing-library/vue supports ESM { name: 'vitest:browser:support-testing-library', config() { return { - define: { - // testing-library/preact - 'process.env.PTL_SKIP_AUTO_CLEANUP': !!process.env.PTL_SKIP_AUTO_CLEANUP, - // testing-library/react - 'process.env.RTL_SKIP_AUTO_CLEANUP': !!process.env.RTL_SKIP_AUTO_CLEANUP, - 'process.env?.RTL_SKIP_AUTO_CLEANUP': !!process.env.RTL_SKIP_AUTO_CLEANUP, - // testing-library/svelte, testing-library/solid - 'process.env.STL_SKIP_AUTO_CLEANUP': !!process.env.STL_SKIP_AUTO_CLEANUP, - // testing-library/vue - 'process.env.VTL_SKIP_AUTO_CLEANUP': !!process.env.VTL_SKIP_AUTO_CLEANUP, - // dom.debug() - 'process.env.DEBUG_PRINT_LIMIT': process.env.DEBUG_PRINT_LIMIT || 7000, - }, optimizeDeps: { esbuildOptions: { plugins: [ From cba86b247285420d29d7c6991b3a2a738f6c7a49 Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Tue, 15 Oct 2024 14:38:53 +0200 Subject: [PATCH 2/3] chore: forgot --- packages/browser/src/node/plugin.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/browser/src/node/plugin.ts b/packages/browser/src/node/plugin.ts index 6fde2c4449a4..a96da95ce8d1 100644 --- a/packages/browser/src/node/plugin.ts +++ b/packages/browser/src/node/plugin.ts @@ -168,7 +168,6 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => { const define: Record = {} for (const env in (project.config.env || {})) { const stringValue = JSON.stringify(project.config.env[env]) - define[`process.env.${env}`] = stringValue define[`import.meta.env.${env}`] = stringValue } From 21996d970bed5a90c344ce5b8c1078ae47495aa4 Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Tue, 15 Oct 2024 14:39:12 +0200 Subject: [PATCH 3/3] test: no process --- test/browser/test/another.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/browser/test/another.test.ts b/test/browser/test/another.test.ts index 1e66b9ab7ea2..31e0886d7897 100644 --- a/test/browser/test/another.test.ts +++ b/test/browser/test/another.test.ts @@ -3,3 +3,7 @@ import { expect, it } from 'vitest' it('basic 3', async () => { expect(globalThis.window).toBeDefined() }) + +it('no process', () => { + expect(globalThis.process).toBeUndefined() +})