Skip to content

Commit

Permalink
chore: use /@id/ for importing
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Mar 22, 2023
1 parent 3589afb commit 96af462
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions packages/browser/src/client/main.ts
Expand Up @@ -25,8 +25,8 @@ const browserHashMap = new Map<string, string>()
const url = new URL(location.href)
const testId = url.searchParams.get('id') || 'unknown'

const plainImport = (id: string) => {
const name = `/@plain/${id}`
const importId = (id: string) => {
const name = `/@id/${id}`
return import(name)
}

Expand Down Expand Up @@ -92,14 +92,14 @@ async function runTests(paths: string[], config: any) {
takeCoverageInsideWorker,
stopCoverageInsideWorker,
startCoverageInsideWorker,
} = await plainImport('vitest/browser') as typeof import('vitest/browser')
} = await importId('vitest/browser') as typeof import('vitest/browser')

const executor = {
executeId: (id: string) => plainImport(id),
executeId: (id: string) => importId(id),
}

if (!runner) {
const { VitestTestRunner } = await plainImport('vitest/runners') as typeof import('vitest/runners')
const { VitestTestRunner } = await importId('vitest/runners') as typeof import('vitest/runners')
const BrowserRunner = createBrowserRunner(VitestTestRunner, { takeCoverage: () => takeCoverageInsideWorker(config.coverage, executor) })
runner = new BrowserRunner({ config, browserHashMap })
}
Expand Down
2 changes: 1 addition & 1 deletion test/browser/specs/runner.test.mjs
Expand Up @@ -5,7 +5,7 @@ import { execa } from 'execa'

const browser = process.env.BROWSER || 'chrome'

const { stderr, stdout } = await execa('npx', ['vitest', `--browser=${browser}`], {
const { stderr, stdout } = await execa('npx', ['vitest', `--browser=${browser}`, '--browser.headless'], {
env: {
...process.env,
CI: 'true',
Expand Down

0 comments on commit 96af462

Please sign in to comment.