Skip to content

Commit ed15b5b

Browse files
authoredFeb 4, 2025··
fix(workspace): forward inspect related cli options (#7373)
1 parent 7ef238c commit ed15b5b

File tree

4 files changed

+36
-10
lines changed

4 files changed

+36
-10
lines changed
 

‎packages/vitest/src/node/workspace/resolveWorkspace.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export async function resolveWorkspace(
4444
'bail',
4545
'isolate',
4646
'printConsoleTrace',
47+
'inspect',
48+
'inspectBrk',
49+
'fileParallelism',
4750
] as const
4851

4952
const cliOverrides = overridesOptions.reduce((acc, name) => {
@@ -73,7 +76,7 @@ export async function resolveWorkspace(
7376
projectPromises.push(concurrent(() => initializeProject(
7477
index,
7578
vitest,
76-
{ ...options, root, configFile },
79+
{ ...options, root, configFile, test: { ...options.test, ...cliOverrides } },
7780
)))
7881
})
7982

‎test/browser/fixtures/inspect/vitest.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default defineConfig({
55
test: {
66
watch: false,
77
browser: {
8+
enabled: true,
89
provider: "playwright",
910
name: "chromium",
1011
headless: true,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
export default defineConfig({
4+
server: { port: 5199 },
5+
test: {
6+
watch: false,
7+
8+
workspace: [
9+
{
10+
test: {
11+
name: "Browser in workspace",
12+
browser: {
13+
provider: "playwright",
14+
enabled: true,
15+
headless: true,
16+
instances: [{ browser: "chromium" }]
17+
},
18+
},
19+
},
20+
],
21+
},
22+
});

‎test/browser/specs/inspect.test.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ type Message = Partial<InspectorNotification<any>>
99
const IS_PLAYWRIGHT = process.env.PROVIDER === 'playwright'
1010
const REMOTE_DEBUG_URL = '127.0.0.1:9123'
1111

12-
test.runIf(IS_PLAYWRIGHT || !process.env.CI)('--inspect-brk stops at test file', async () => {
13-
const { vitest, waitForClose } = await runVitestCli(
14-
'--root',
15-
'fixtures/inspect',
16-
'--browser',
17-
'--no-file-parallelism',
18-
'--inspect-brk',
19-
REMOTE_DEBUG_URL,
20-
)
12+
test.runIf(IS_PLAYWRIGHT || !process.env.CI).each(['', 'with workspace'])('--inspect-brk stops at test file %s', async (isWorkspace) => {
13+
const options = ['--root', 'fixtures/inspect', '--no-file-parallelism', '--inspect-brk', REMOTE_DEBUG_URL]
14+
15+
if (isWorkspace) {
16+
options.push('--config')
17+
options.push('vitest.config.with-workspace.ts')
18+
}
19+
20+
const { vitest, waitForClose } = await runVitestCli(...options)
2121

2222
await vitest.waitForStdout(`Debugger listening on ws://${REMOTE_DEBUG_URL}`)
2323

0 commit comments

Comments
 (0)
Please sign in to comment.