diff --git a/examples/mocks/test/error-mock.spec.ts b/examples/mocks/test/error-mock.spec.ts index bae95d70fd75..044b200aa1ae 100644 --- a/examples/mocks/test/error-mock.spec.ts +++ b/examples/mocks/test/error-mock.spec.ts @@ -4,5 +4,5 @@ vi.mock('../src/default', () => { test('when using top level variable, gives helpful message', async () => { await expect(() => import('../src/default').then(m => m.default)).rejects - .toThrowErrorMatchingInlineSnapshot('"[vitest] There was an error when mocking a module. If you are using \\"vi.mock\\" factory, make sure there are no top level variables inside, since this call is hoisted to top of the file. Read more: https://vitest.dev/api/#vi-mock"') + .toThrowErrorMatchingInlineSnapshot('"[vitest] There was an error when mocking a module. If you are using \\"vi.mock\\" factory, make sure there are no top level variables inside, since this call is hoisted to top of the file. Read more: https://vitest.dev/api/vi.html#vi-mock"') }) diff --git a/packages/vitest/src/runtime/mocker.ts b/packages/vitest/src/runtime/mocker.ts index ca5687e3ed2b..a3f617113b50 100644 --- a/packages/vitest/src/runtime/mocker.ts +++ b/packages/vitest/src/runtime/mocker.ts @@ -116,7 +116,7 @@ export class VitestMocker { const vitestError = new Error( '[vitest] There was an error when mocking a module. ' + 'If you are using "vi.mock" factory, make sure there are no top level variables inside, since this call is hoisted to top of the file. ' - + 'Read more: https://vitest.dev/api/#vi-mock') + + 'Read more: https://vitest.dev/api/vi.html#vi-mock') vitestError.cause = err throw vitestError }