-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(component-testing): implement mocks
- Loading branch information
Showing
19 changed files
with
1,578 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,19 @@ | ||
export * from "./vitest-spy"; | ||
import { isRunInBrowserEnv } from "../utils/browser"; | ||
|
||
// TODO: use from browser code when migrate to esm | ||
type MockFactory = (originalImport?: unknown) => Promise<unknown>; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export function mock(_moduleName: string, _factory?: MockFactory): void { | ||
if (!isRunInBrowserEnv()) { | ||
throw new Error('"mock" method is available only in browser environment'); | ||
} | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export function unmock(_moduleName: string): void { | ||
if (!isRunInBrowserEnv()) { | ||
throw new Error('"unmock" method is available only in browser environment'); | ||
} | ||
} |
Oops, something went wrong.