Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update spy type inference (#643)
* fix: update spy type inference * test: add test case for `spyOn` type inference * refactor: merge overload declarations * chore: remove unused parameter * test: use `happy-dom` * test: skip flaky test Co-authored-by: Ivan Demchuk <ivan.demchuk@gmail.com>
- Loading branch information
Showing
2 changed files
with
14 additions
and
9 deletions.
There are no files selected for viewing
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,12 @@ | ||
import { describe, expect, spyOn, test } from 'vitest' | ||
|
||
/** | ||
* @vitest-environment happy-dom | ||
*/ | ||
|
||
describe('spyOn', () => { | ||
test('correctly infers method types', async() => { | ||
spyOn(localStorage, 'getItem').mockReturnValue('world') | ||
expect(window.localStorage.getItem('hello')).toEqual('world') | ||
}) | ||
}) |