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
2 changes: 1 addition & 1 deletion packages/browser/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const RPC_ID: string
const METHOD = getBrowserState().method
export const ENTRY_URL: string = `${
location.protocol === 'https:' ? 'wss:' : 'ws:'
}//${HOST}/__vitest_browser_api__?type=${PAGE_TYPE}&rpcId=${RPC_ID}&sessionId=${getBrowserState().sessionId}&projectName=${getBrowserState().config.name || ''}&method=${METHOD}&token=${(window as any).VITEST_API_TOKEN || '0'}`
}//${HOST}/__vitest_browser_api__?type=${PAGE_TYPE}&rpcId=${RPC_ID}&sessionId=${getBrowserState().sessionId}&projectName=${encodeURIComponent(getBrowserState().config.name || '')}&method=${METHOD}&token=${(window as any).VITEST_API_TOKEN || '0'}`

const onCancelCallbacks: ((reason: CancelReason) => void)[] = []

Expand Down
5 changes: 5 additions & 0 deletions test/browser/fixtures/project-name-encoding/basic.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { expect, test } from 'vitest'

test('basic test', () => {
expect(true).toBe(true)
})
11 changes: 11 additions & 0 deletions test/browser/fixtures/project-name-encoding/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
name: 'Components & Hooks',
browser: {
enabled: true,
headless: true,
},
},
})
21 changes: 21 additions & 0 deletions test/browser/specs/project-name-encoding.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { expect, test } from 'vitest'
import { instances, provider, runBrowserTests } from './utils'

test('runs tests correctly when project name contains special characters', async () => {
const { stderr, stdout, exitCode, ctx } = await runBrowserTests({
root: './fixtures/project-name-encoding',
browser: {
provider,
instances,
},
})

expect(stderr).toBe('')
expect(exitCode).toBe(0)

const projectName = ctx.config.name

instances.forEach(({ browser }) => {
expect(stdout).toReportPassedTest('basic.test.ts', `${projectName} (${browser})`)
})
})
Loading