From f851982e2bd0e287793456e019b364e1bbb7bdbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ari=20Perkki=C3=B6?= Date: Sat, 13 Jul 2024 19:43:14 +0300 Subject: [PATCH] fix: `--inspect-brk` stop on Windows (#6110) --- packages/vitest/src/runtime/inspector.ts | 4 ++-- test/cli/test/inspect.test.ts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/vitest/src/runtime/inspector.ts b/packages/vitest/src/runtime/inspector.ts index d83b192ef35d..0e18b60259aa 100644 --- a/packages/vitest/src/runtime/inspector.ts +++ b/packages/vitest/src/runtime/inspector.ts @@ -1,5 +1,5 @@ import { createRequire } from 'node:module' - +import { pathToFileURL } from 'node:url' import type { ContextRPC, ResolvedConfig } from '../types' const __require = createRequire(import.meta.url) @@ -37,7 +37,7 @@ export function setupInspect(ctx: ContextRPC) { session.post('Debugger.enable') session.post('Debugger.setBreakpointByUrl', { lineNumber: 0, - url: new URL(firstTestFile, import.meta.url).href, + url: pathToFileURL(firstTestFile), }) } } diff --git a/test/cli/test/inspect.test.ts b/test/cli/test/inspect.test.ts index bb4c7ce7ca46..9a0ae290eb55 100644 --- a/test/cli/test/inspect.test.ts +++ b/test/cli/test/inspect.test.ts @@ -2,12 +2,11 @@ import type { InspectorNotification } from 'node:inspector' import { expect, test } from 'vitest' import WebSocket from 'ws' -import { isWindows } from '../../../packages/vite-node/src/utils' import { runVitestCli } from '../../test-utils' type Message = Partial> -test.skipIf(isWindows)('--inspect-brk stops at test file', async () => { +test('--inspect-brk stops at test file', async () => { const { vitest, waitForClose } = await runVitestCli( '--root', 'fixtures/inspect',