Skip to content

Commit

Permalink
docs: improve TypeScript Usage documentation with few additional notes (
Browse files Browse the repository at this point in the history
  • Loading branch information
mrazauskas committed Nov 11, 2022
1 parent 05deb83 commit 6fc1860
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 30 deletions.
8 changes: 7 additions & 1 deletion docs/GettingStarted.md
Expand Up @@ -168,7 +168,13 @@ In order for Jest to transpile TypeScript with `ts-jest`, you may also need to c

There are two ways to have [Jest global APIs](GlobalAPI.md) typed for test files written in TypeScript.

You can use type definitions which ships with Jest and will update each time you update Jest. Simply import the APIs from `@jest/globals` package:
You can use type definitions which ships with Jest and will update each time you update Jest. Install the `@jest/globals` package:

```bash npm2yarn
npm install --save-dev @jest/globals
```

And import the APIs from it:

```ts title="sum.test.ts"
import {describe, expect, test} from '@jest/globals';
Expand Down
2 changes: 2 additions & 0 deletions docs/GlobalAPI.md
Expand Up @@ -973,6 +973,8 @@ test.todo('add should be associative');

## TypeScript Usage

<TypeScriptExamplesNote />

### `.each`

The `.each` modifier offers few different ways to define a table of the test cases. Some of the APIs have caveats related with the type inference of the arguments which are passed to `describe` or `test` callback functions. Let's take a look at each of them.
Expand Down
6 changes: 1 addition & 5 deletions docs/MockFunctionAPI.md
Expand Up @@ -517,11 +517,7 @@ test('async test', async () => {

## TypeScript Usage

:::tip

Please consult the [Getting Started](GettingStarted.md#using-typescript) guide for details on how to setup Jest with TypeScript.

:::
<TypeScriptExamplesNote />

### `jest.fn(implementation?)`

Expand Down
2 changes: 2 additions & 0 deletions docs/_TypeScriptExamplesNote.md
Expand Up @@ -6,4 +6,6 @@ The TypeScript examples from this page will only work as documented if you expli
import {expect, jest, test} from '@jest/globals';
```

Consult the [Getting Started](GettingStarted.md#using-typescript) guide for details on how to setup Jest with TypeScript.

:::
8 changes: 7 additions & 1 deletion website/versioned_docs/version-29.0/GettingStarted.md
Expand Up @@ -164,7 +164,13 @@ In order for Jest to transpile TypeScript with `ts-jest`, you may also need to c

There are two ways to have [Jest global APIs](GlobalAPI.md) typed for test files written in TypeScript.

You can use type definitions which ships with Jest and will update each time you update Jest. Simply import the APIs from `@jest/globals` package:
You can use type definitions which ships with Jest and will update each time you update Jest. Install the `@jest/globals` package:

```bash npm2yarn
npm install --save-dev @jest/globals
```

And import the APIs from it:

```ts title="sum.test.ts"
import {describe, expect, test} from '@jest/globals';
Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-29.0/GlobalAPI.md
Expand Up @@ -973,6 +973,8 @@ test.todo('add should be associative');

## TypeScript Usage

<TypeScriptExamplesNote />

### `.each`

The `.each` modifier offers few different ways to define a table of the test cases. Some of the APIs have caveats related with the type inference of the arguments which are passed to `describe` or `test` callback functions. Let's take a look at each of them.
Expand Down
6 changes: 1 addition & 5 deletions website/versioned_docs/version-29.0/MockFunctionAPI.md
Expand Up @@ -480,11 +480,7 @@ test('async test', async () => {

## TypeScript Usage

:::tip

Please consult the [Getting Started](GettingStarted.md#using-typescript) guide for details on how to setup Jest with TypeScript.

:::
<TypeScriptExamplesNote />

### `jest.fn(implementation?)`

Expand Down
Expand Up @@ -6,4 +6,6 @@ The TypeScript examples from this page will only work as documented if you expli
import {expect, jest, test} from '@jest/globals';
```

Consult the [Getting Started](GettingStarted.md#using-typescript) guide for details on how to setup Jest with TypeScript.

:::
8 changes: 7 additions & 1 deletion website/versioned_docs/version-29.1/GettingStarted.md
Expand Up @@ -168,7 +168,13 @@ In order for Jest to transpile TypeScript with `ts-jest`, you may also need to c

There are two ways to have [Jest global APIs](GlobalAPI.md) typed for test files written in TypeScript.

You can use type definitions which ships with Jest and will update each time you update Jest. Simply import the APIs from `@jest/globals` package:
You can use type definitions which ships with Jest and will update each time you update Jest. Install the `@jest/globals` package:

```bash npm2yarn
npm install --save-dev @jest/globals
```

And import the testing APIs from it:

```ts title="sum.test.ts"
import {describe, expect, test} from '@jest/globals';
Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-29.1/GlobalAPI.md
Expand Up @@ -973,6 +973,8 @@ test.todo('add should be associative');

## TypeScript Usage

<TypeScriptExamplesNote />

### `.each`

The `.each` modifier offers few different ways to define a table of the test cases. Some of the APIs have caveats related with the type inference of the arguments which are passed to `describe` or `test` callback functions. Let's take a look at each of them.
Expand Down
6 changes: 1 addition & 5 deletions website/versioned_docs/version-29.1/MockFunctionAPI.md
Expand Up @@ -517,11 +517,7 @@ test('async test', async () => {

## TypeScript Usage

:::tip

Please consult the [Getting Started](GettingStarted.md#using-typescript) guide for details on how to setup Jest with TypeScript.

:::
<TypeScriptExamplesNote />

### `jest.fn(implementation?)`

Expand Down
Expand Up @@ -6,4 +6,6 @@ The TypeScript examples from this page will only work as documented if you expli
import {expect, jest, test} from '@jest/globals';
```

Consult the [Getting Started](GettingStarted.md#using-typescript) guide for details on how to setup Jest with TypeScript.

:::
8 changes: 7 additions & 1 deletion website/versioned_docs/version-29.2/GettingStarted.md
Expand Up @@ -168,7 +168,13 @@ In order for Jest to transpile TypeScript with `ts-jest`, you may also need to c

There are two ways to have [Jest global APIs](GlobalAPI.md) typed for test files written in TypeScript.

You can use type definitions which ships with Jest and will update each time you update Jest. Simply import the APIs from `@jest/globals` package:
You can use type definitions which ships with Jest and will update each time you update Jest. Install the `@jest/globals` package:

```bash npm2yarn
npm install --save-dev @jest/globals
```

And import the testing APIs from it:

```ts title="sum.test.ts"
import {describe, expect, test} from '@jest/globals';
Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-29.2/GlobalAPI.md
Expand Up @@ -973,6 +973,8 @@ test.todo('add should be associative');

## TypeScript Usage

<TypeScriptExamplesNote />

### `.each`

The `.each` modifier offers few different ways to define a table of the test cases. Some of the APIs have caveats related with the type inference of the arguments which are passed to `describe` or `test` callback functions. Let's take a look at each of them.
Expand Down
6 changes: 1 addition & 5 deletions website/versioned_docs/version-29.2/MockFunctionAPI.md
Expand Up @@ -517,11 +517,7 @@ test('async test', async () => {

## TypeScript Usage

:::tip

Please consult the [Getting Started](GettingStarted.md#using-typescript) guide for details on how to setup Jest with TypeScript.

:::
<TypeScriptExamplesNote />

### `jest.fn(implementation?)`

Expand Down
Expand Up @@ -6,4 +6,6 @@ The TypeScript examples from this page will only work as documented if you expli
import {expect, jest, test} from '@jest/globals';
```

Consult the [Getting Started](GettingStarted.md#using-typescript) guide for details on how to setup Jest with TypeScript.

:::
8 changes: 7 additions & 1 deletion website/versioned_docs/version-29.3/GettingStarted.md
Expand Up @@ -168,7 +168,13 @@ In order for Jest to transpile TypeScript with `ts-jest`, you may also need to c

There are two ways to have [Jest global APIs](GlobalAPI.md) typed for test files written in TypeScript.

You can use type definitions which ships with Jest and will update each time you update Jest. Simply import the APIs from `@jest/globals` package:
You can use type definitions which ships with Jest and will update each time you update Jest. Install the `@jest/globals` package:

```bash npm2yarn
npm install --save-dev @jest/globals
```

And import the testing APIs from it:

```ts title="sum.test.ts"
import {describe, expect, test} from '@jest/globals';
Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-29.3/GlobalAPI.md
Expand Up @@ -973,6 +973,8 @@ test.todo('add should be associative');

## TypeScript Usage

<TypeScriptExamplesNote />

### `.each`

The `.each` modifier offers few different ways to define a table of the test cases. Some of the APIs have caveats related with the type inference of the arguments which are passed to `describe` or `test` callback functions. Let's take a look at each of them.
Expand Down
6 changes: 1 addition & 5 deletions website/versioned_docs/version-29.3/MockFunctionAPI.md
Expand Up @@ -517,11 +517,7 @@ test('async test', async () => {

## TypeScript Usage

:::tip

Please consult the [Getting Started](GettingStarted.md#using-typescript) guide for details on how to setup Jest with TypeScript.

:::
<TypeScriptExamplesNote />

### `jest.fn(implementation?)`

Expand Down
Expand Up @@ -6,4 +6,6 @@ The TypeScript examples from this page will only work as documented if you expli
import {expect, jest, test} from '@jest/globals';
```

Consult the [Getting Started](GettingStarted.md#using-typescript) guide for details on how to setup Jest with TypeScript.

:::

0 comments on commit 6fc1860

Please sign in to comment.