-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(browser): run test files in isolated iframes (#5036)
- Loading branch information
1 parent
b607f1e
commit 4f40177
Showing
29 changed files
with
808 additions
and
490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { CancelReason } from '@vitest/runner' | ||
import { createClient } from '@vitest/ws-client' | ||
|
||
export const PORT = import.meta.hot ? '51204' : location.port | ||
export const HOST = [location.hostname, PORT].filter(Boolean).join(':') | ||
export const ENTRY_URL = `${ | ||
location.protocol === 'https:' ? 'wss:' : 'ws:' | ||
}//${HOST}/__vitest_api__` | ||
|
||
let setCancel = (_: CancelReason) => {} | ||
export const onCancel = new Promise<CancelReason>((resolve) => { | ||
setCancel = resolve | ||
}) | ||
|
||
export const client = createClient(ENTRY_URL, { | ||
handlers: { | ||
onCancel: setCancel, | ||
}, | ||
}) | ||
|
||
export const channel = new BroadcastChannel('vitest') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.