Skip to content

Commit

Permalink
🤖 Merge PR #62714 [jest] add types for jest.getSeed() method by @mr…
Browse files Browse the repository at this point in the history
…azauskas

* [jest] add types of `jest.getSeed` method

* bump version
  • Loading branch information
mrazauskas committed Oct 18, 2022
1 parent d66fefd commit 8d5e1a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion types/jest/index.d.ts
@@ -1,4 +1,4 @@
// Type definitions for Jest 29.1
// Type definitions for Jest 29.2
// Project: https://jestjs.io/
// Definitions by: Asana (https://asana.com)
// Ivo Stratev <https://github.com/NoHomey>
Expand Down Expand Up @@ -211,6 +211,11 @@ declare namespace jest {
* > implementation
*/
function getRealSystemTime(): number;
/**
* Retrieves the seed value. It will be randomly generated for each test run
* or can be manually set via the `--seed` CLI argument.
*/
function getSeed(): number;
/**
* Returns the current time in ms of the fake timer clock.
*/
Expand Down
5 changes: 5 additions & 0 deletions types/jest/jest-tests.ts
Expand Up @@ -413,6 +413,11 @@ const realSystemTime1: number = jest.getRealSystemTime();
// @ts-expect-error
const realSystemTime2: number = jest.getRealSystemTime('foo');

// https://jestjs.io/docs/en/jest-object#jestgetseed
const seed1: number = jest.getSeed();
// @ts-expect-error
const seed2: number = jest.getSeed('foo');

// $ExpectType number
jest.now();
// @ts-expect-error
Expand Down

0 comments on commit 8d5e1a1

Please sign in to comment.