Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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)
})
14 changes: 14 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,14 @@
import { defineConfig } from 'vitest/config'
import { provider } from '../../settings'

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

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

Choose a reason for hiding this comment

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

This root is not correct, the cwd is test/browser already

})

expect(stderr).toBe('')
expect(exitCode).toBe(0)
expect(stdout).toContain('Test Files 1 passed')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Look at the code in other files, don't use toContain, use toReportPassedTest

expect(stdout).toContain('Components & Hooks')
})
Loading