Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/vitest/src/node/workspace/resolveWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export async function resolveWorkspace(
'bail',
'isolate',
'printConsoleTrace',
'inspect',
'inspectBrk',
'fileParallelism',
Comment on lines +47 to +49
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably pass --browser too, as this kind of situation is kind of weird:

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh well it's not actually as simple as adding browser in the CLI overrides. The resolveConfig is overwriting browser.enabled.

] as const

const cliOverrides = overridesOptions.reduce((acc, name) => {
Expand Down Expand Up @@ -73,7 +76,7 @@ export async function resolveWorkspace(
projectPromises.push(concurrent(() => initializeProject(
index,
vitest,
{ ...options, root, configFile },
{ ...options, root, configFile, test: { ...options.test, ...cliOverrides } },
)))
})

Expand Down
1 change: 1 addition & 0 deletions test/browser/fixtures/inspect/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default defineConfig({
test: {
watch: false,
browser: {
enabled: true,
provider: "playwright",
name: "chromium",
headless: true,
Expand Down
22 changes: 22 additions & 0 deletions test/browser/fixtures/inspect/vitest.config.with-workspace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
server: { port: 5199 },
test: {
watch: false,

workspace: [
{
test: {
name: "Browser in workspace",
browser: {
provider: "playwright",
enabled: true,
headless: true,
instances: [{ browser: "chromium" }]
},
},
},
],
},
});
18 changes: 9 additions & 9 deletions test/browser/specs/inspect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ type Message = Partial<InspectorNotification<any>>
const IS_PLAYWRIGHT = process.env.PROVIDER === 'playwright'
const REMOTE_DEBUG_URL = '127.0.0.1:9123'

test.runIf(IS_PLAYWRIGHT || !process.env.CI)('--inspect-brk stops at test file', async () => {
const { vitest, waitForClose } = await runVitestCli(
'--root',
'fixtures/inspect',
'--browser',
'--no-file-parallelism',
'--inspect-brk',
REMOTE_DEBUG_URL,
)
test.runIf(IS_PLAYWRIGHT || !process.env.CI).each(['', 'with workspace'])('--inspect-brk stops at test file %s', async (isWorkspace) => {
const options = ['--root', 'fixtures/inspect', '--no-file-parallelism', '--inspect-brk', REMOTE_DEBUG_URL]

if (isWorkspace) {
options.push('--config')
options.push('vitest.config.with-workspace.ts')
}

const { vitest, waitForClose } = await runVitestCli(...options)

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

Expand Down