Skip to content

Commit

Permalink
chore: replace vi.importActual with importOriginal
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Dec 27, 2023
1 parent 874ae56 commit 48a58d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vitest/src/runtime/mocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ export class VitestMocker {
throw this.createError(
`[vitest] No "${String(prop)}" export is defined on the "${mockpath}" mock. `
+ 'Did you forget to return it from "vi.mock"?'
+ '\nIf you need to partially mock a module, you can use "vi.importActual" inside:\n\n'
+ `${c.green(`vi.mock("${mockpath}", async () => {
const actual = await vi.importActual("${mockpath}")
+ '\nIf you need to partially mock a module, you can use "importOriginal" helper inside:\n\n'
+ `${c.green(`vi.mock("${mockpath}", async (importOriginal) => {
const actual = await importOriginal()
return {
...actual,
// your mocked methods
Expand Down

0 comments on commit 48a58d3

Please sign in to comment.