From da6d2ea72ca06d54e32bc744a4ca0c580635ab71 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Tue, 15 Oct 2024 14:54:54 +0200 Subject: [PATCH] fix(browser): don't polyfill process.env (#6718) --- packages/browser/src/node/plugin.ts | 15 --------------- test/browser/test/another.test.ts | 4 ++++ 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/browser/src/node/plugin.ts b/packages/browser/src/node/plugin.ts index 524fb9bf3307..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 } @@ -388,24 +387,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: [ 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() +})