@vitest/spy
Advanced tools
Comparing version 2.2.0-beta.2 to 3.0.0-beta.1
@@ -171,4 +171,7 @@ interface MockResultReturn<T> { | ||
/** | ||
* Performs the same actions as `mockClear` and sets the inner implementation to an empty function (returning `undefined` when invoked). This also resets all "once" implementations. It is useful for completely resetting a mock to its default state. | ||
* Does what `mockClear` does and resets inner implementation to the original function. This also resets all "once" implementations. | ||
* | ||
* Note that resetting a mock from `vi.fn()` will set implementation to an empty function that returns `undefined`. | ||
* Resetting a mock from `vi.fn(impl)` will set implementation to `impl`. It is useful for completely resetting a mock to its default state. | ||
* | ||
* To automatically call this method before each test, enable the [`mockReset`](https://vitest.dev/config/#mockreset) setting in the configuration. | ||
@@ -179,3 +182,3 @@ * @see https://vitest.dev/api/mock#mockreset | ||
/** | ||
* Does what `mockReset` does and restores inner implementation to the original function. | ||
* Does what `mockReset` does and restores original descriptors of spied-on objects. | ||
* | ||
@@ -182,0 +185,0 @@ * Note that restoring mock from `vi.fn()` will set implementation to an empty function that returns `undefined`. Restoring a `vi.fn(impl)` will restore implementation to `impl`. |
@@ -78,3 +78,3 @@ import * as tinyspy from 'tinyspy'; | ||
stub.mockClear(); | ||
implementation = () => void 0; | ||
implementation = void 0; | ||
onceImplementations = []; | ||
@@ -86,3 +86,2 @@ return stub; | ||
state.restore(); | ||
implementation = void 0; | ||
return stub; | ||
@@ -89,0 +88,0 @@ }; |
{ | ||
"name": "@vitest/spy", | ||
"type": "module", | ||
"version": "2.2.0-beta.2", | ||
"version": "3.0.0-beta.1", | ||
"description": "Lightweight Jest compatible spy implementation", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
21863
495