From 597d80c39782fe8b83999ebe41f44d4ec8623225 Mon Sep 17 00:00:00 2001 From: hahanein Date: Fri, 2 Feb 2024 20:34:59 +0100 Subject: [PATCH] Fix one-line environment options --- packages/vitest/src/utils/test-helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vitest/src/utils/test-helpers.ts b/packages/vitest/src/utils/test-helpers.ts index a3eb3970ce04..4a1f55a85f65 100644 --- a/packages/vitest/src/utils/test-helpers.ts +++ b/packages/vitest/src/utils/test-helpers.ts @@ -45,7 +45,7 @@ export async function groupFilesByEnv(files: (readonly [WorkspaceProject, string const transformMode = getTransformMode(project.config.testTransformMode, file) - const envOptions = JSON.parse(code.match(/@(?:vitest|jest)-environment-options\s+?(.+)/)?.[1] || 'null') + const envOptions = JSON.parse(code.match(/@(?:vitest|jest)-environment-options\s+?(.+)(?=\*\/$|$)/)?.[1] || 'null') const envKey = env === 'happy-dom' ? 'happyDOM' : env const environment: ContextTestEnvironment = { name: env as VitestEnvironment,