Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow mocking property value in tests #13496

Merged
merged 22 commits into from
Jan 4, 2023
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
15697c7
feat(jest-mock): Add mockProperty() method
Oct 23, 2022
9c270ca
feat(jest-environment): Add mockProperty() method type to global Jest…
Oct 23, 2022
20b881b
refactor(jest-mock): Be more strict for MockedPropertyRestorer generi…
Dec 19, 2022
930036d
refactor(jest-mock): Allow mocking property named '0' or ""
Dec 19, 2022
c739864
refactor(jest-mock): Throw more descriptive error messages when tryin…
Dec 19, 2022
0f227c2
refactor(jest-mock): Allow mocking already mocked property with diffe…
Dec 19, 2022
1c4535b
refactor(jest-mock): Add type tests for mockProperty
Dec 19, 2022
4a1aeb6
refactor(jest-runtime): Fix missing mockProperty export
Dec 19, 2022
c79837d
Merge remote-tracking branch 'upstream/main'
Dec 19, 2022
cceffa0
refactor(jest-mock): Fix typing and interface of mockProperty methods
Dec 20, 2022
6c17cc0
refactor(jest-mock, docs): Document replaceProperty method and its im…
Dec 20, 2022
d828f11
refactor(docs): Remove forgotten TODO
Dec 20, 2022
4f9ac47
refactor(jest-mock, jest-types): Add additional tests for replaced pr…
Dec 25, 2022
b3fb383
refactor(jest-environment, jest-globals): Fix JSDoc comments for repl…
Dec 25, 2022
208df4d
refactor(docs): Improve style of replaced property sections and apply…
Dec 25, 2022
2ed2ca8
Merge branch 'main' into main
SimenB Jan 3, 2023
ba36a3b
Update docs/MockFunctionAPI.md
SimenB Jan 3, 2023
25d1b24
Merge remote-tracking branch 'upstream/main'
Jan 3, 2023
472841c
refactor(jest-mock): Fix type tests compatibility with TS 4.3
Jan 3, 2023
2f9c9c9
refactor(jest-runtime): Fix forgotten rename of replaceProperty from …
Jan 3, 2023
33c30b9
refactor(jest-mock): Hint to use replaceProperty when trying to mock …
Jan 3, 2023
f0ffae1
refactor(docs): Relate two files in examples by providing correct path
Jan 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refactor(docs): Relate two files in examples by providing correct path
Michal Kočárek committed Jan 3, 2023

Unverified

No user is associated with the committer email.
commit f0ffae189836c4dfea30c54a39fe26dbdc28bce6
2 changes: 1 addition & 1 deletion docs/MockFunctionAPI.md
Original file line number Diff line number Diff line change
@@ -618,7 +618,7 @@ export function isLocalhost(): boolean {
}
```

```ts
```ts title="src/__tests__/utils.test.ts"
import {afterEach, expect, it, jest} from '@jest/globals';
import {isLocalhost} from '../utils';