(path: string | Promise<unknown>, factory?: MockOptions | MockFactoryWithHelper)
| 628 | }, |
| 629 | |
| 630 | mock(path: string | Promise<unknown>, factory?: MockOptions | MockFactoryWithHelper) { |
| 631 | if (typeof path !== 'string') { |
| 632 | throw new TypeError( |
| 633 | `vi.mock() expects a string path, but received a ${typeof path}`, |
| 634 | ) |
| 635 | } |
| 636 | const importer = getImporter('mock') |
| 637 | _mocker().queueMock( |
| 638 | path, |
| 639 | importer, |
| 640 | typeof factory === 'function' |
| 641 | ? () => |
| 642 | factory(() => |
| 643 | _mocker().importActual( |
| 644 | path, |
| 645 | importer, |
| 646 | _mocker().getMockContext().callstack, |
| 647 | ), |
| 648 | ) |
| 649 | : factory, |
| 650 | ) |
| 651 | }, |
| 652 | |
| 653 | unmock(path: string | Promise<unknown>) { |
| 654 | if (typeof path !== 'string') { |
nothing calls this directly
no test coverage detected
searching dependent graphs…