Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement module mocking in browser mode #5765

Merged
merged 33 commits into from
May 31, 2024
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
87736f3
feat: implement module mocking in the browser
sheremet-va May 23, 2024
e90b2f4
chore: cleanup
sheremet-va May 23, 2024
f6e724a
fix: correctly invalidate mocked module
sheremet-va May 23, 2024
74d14ad
feat: support __mocks__ folder
sheremet-va May 23, 2024
ffaf094
feat: support automocking
sheremet-va May 23, 2024
0c4de84
fix: remove slowHijackESM
sheremet-va May 23, 2024
f5c00fe
fix: add uniqe name to the error
sheremet-va May 23, 2024
38e9028
test: update module browser tests
sheremet-va May 24, 2024
4b0969f
chore: todo
sheremet-va May 24, 2024
b944a4b
chore: expose browser name
sheremet-va May 24, 2024
01aae91
chore: fix the testResults count
sheremet-va May 24, 2024
a727812
chore: fix mocking in --no-isolate mode
sheremet-va May 24, 2024
ab8d756
test: add tests for mocking
sheremet-va May 24, 2024
1634d0d
test: add test for nested dependencies
sheremet-va May 24, 2024
47ef4a0
chore: don't bundle tinyspy and tinybecnh with std-env
sheremet-va May 24, 2024
6b932d3
chore: cleanup
sheremet-va May 24, 2024
83ffe11
chore: print better debug error
sheremet-va May 24, 2024
3fe6f59
chore: remove exportAll util
sheremet-va May 24, 2024
97b7ecf
chore: remove scripts from the resolved config
sheremet-va May 24, 2024
d0896e6
fix: do not hoist vi.mock in vitest package
sheremet-va May 24, 2024
5e904df
chore: only ignore the Vitest dist
sheremet-va May 24, 2024
d9fcdc5
chore: fix typing issue
sheremet-va May 24, 2024
95b1430
feat: split the ws rpc for the browser mode
sheremet-va May 25, 2024
d7beeda
chore: fix types
sheremet-va May 25, 2024
ddca7a1
feat: support all export syntaxes for automocking
sheremet-va May 25, 2024
9677d06
chore: remove Symbol from automocker
sheremet-va May 28, 2024
5b06fb5
chore: remove await
sheremet-va May 28, 2024
a77531e
feat: support vi.importActual
sheremet-va May 28, 2024
958e066
chore: remove browser mock section
sheremet-va May 28, 2024
2bb081b
chore: move test
sheremet-va May 31, 2024
cbc9567
feat: support vi.importMock
sheremet-va May 31, 2024
ab8af86
test: add tets for doMock
sheremet-va May 31, 2024
927449e
fix: correctly parse url on Windows
sheremet-va May 31, 2024
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
Prev Previous commit
Next Next commit
chore: fix types
  • Loading branch information
sheremet-va committed May 31, 2024
commit d7beeda5a839e86e13e66cd296cfe3856be79064
4 changes: 2 additions & 2 deletions packages/browser/src/client/snapshot.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { VitestClient } from '@vitest/ws-client'
import type { SnapshotEnvironment } from 'vitest/snapshot'
import type { VitestBrowserClient } from './client'

export class VitestBrowserSnapshotEnvironment implements SnapshotEnvironment {
getVersion(): string {
Expand Down Expand Up @@ -31,7 +31,7 @@ export class VitestBrowserSnapshotEnvironment implements SnapshotEnvironment {
}
}

function rpc(): VitestClient['rpc'] {
function rpc(): VitestBrowserClient['rpc'] {
// @ts-expect-error not typed global
return globalThis.__vitest_worker__.rpc
}