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

chore(release): 29.0.1 #3810

Merged
merged 1 commit into from Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,17 @@
## [29.0.1](https://github.com/kulshekhar/ts-jest/compare/v29.0.0...v29.0.1) (2022-09-13)


### Bug Fixes

* **legacy:** include existing globals config in cached config ([#3803](https://github.com/kulshekhar/ts-jest/issues/3803)) ([e79be47](https://github.com/kulshekhar/ts-jest/commit/e79be47d2b81a677d0dd39d84328a38ca0f0ffc6))


### Features

* add typings for `ts-jest` options via `transform` config ([#3805](https://github.com/kulshekhar/ts-jest/issues/3805)) ([664b0f2](https://github.com/kulshekhar/ts-jest/commit/664b0f2b446a36dd7661f4840ca3dd7722f1f6ff))



# [29.0.0](https://github.com/kulshekhar/ts-jest/compare/v29.0.0-next.1...v29.0.0) (2022-09-08)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "ts-jest",
"version": "29.0.0",
"version": "29.0.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
Expand Down
8 changes: 2 additions & 6 deletions website/versioned_docs/version-29.0/debugging.md
Expand Up @@ -17,14 +17,10 @@ export TS_JEST_LOG=ts-jest.log

**Windows**

Command Prompt (cmd)

```
```Command Prompt tab
set TS_JEST_LOG=ts-jest.log
```

PowerShell

```
```PowerShell tab
$env:TS_JEST_LOG = 'ts-jest.log'
```
Expand Up @@ -7,18 +7,10 @@ title: Installation

You can install `ts-jest` and dependencies all at once with one of the following commands.

#### NPM

```sh
```bash npm2yarn
npm install --save-dev jest typescript ts-jest @types/jest
```

#### Yarn

```sh
yarn add --dev jest typescript ts-jest @types/jest
```

:::tip

Tip: If you get an error with the following `npm` commands such as `npx: command not found`, you can replace `npx XXX` with `node node_modules/.bin/XXX` from the root of your project.
Expand All @@ -34,15 +26,11 @@ To make it transpile TypeScript with `ts-jest`, we will need to create a configu

`ts-jest` can create the configuration file for you automatically:

#### NPM

```sh
```npm tab
npx ts-jest config:init
```

#### Yarn

```sh
```Yarn tab
yarn ts-jest config:init
```

Expand Down
65 changes: 19 additions & 46 deletions website/versioned_docs/version-29.0/getting-started/options.md
Expand Up @@ -8,27 +8,8 @@ title: Options
All `ts-jest` specific options can be defined in Jest `transform` config object in the `package.json` file of your project,
or through a `jest.config.js`, or `jest.config.ts` file.

```json
// package.json
{
// [...]
"jest": {
"transform": {
"<regex_match_files>": [
"ts-jest",
{
// ts-jest configuration goes here
}
]
}
}
}
```

Or through JavaScript:

```js
// jest.config.js
```js tab
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
transform: {
Expand All @@ -42,44 +23,36 @@ module.exports = {
}
```

:::tip
```ts tab
import type { JestConfigWithTsJest } from './types'

To utilize IDE suggestions, you can use `JSDoc` comments to provide suggested `ts-jest` configs for your Jest config:

```js
/** @type {import('ts-jest').InitialOptionsTsJest} */
module.exports = config = {
const jestConfig: JestConfigWithTsJest = {
// [...]
transform: {
'<regex_match_files>': [
'ts-jest',
{
// ts-jest configuration goes here and your IDE will suggest which configs when typing
// ts-jest configuration goes here
},
],
},
}
```

:::

Or through TypeScript (if `ts-node` is installed):

```ts
// jest.config.ts
import type { InitialOptionsTsJest } from 'ts-jest'

const config: InitialOptionsTsJest = {
transform: {
'<regex_match_files>': [
'ts-jest',
{
// ts-jest configuration goes here
},
],
},
```JSON tab
{
// [...]
"jest": {
"transform": {
"<regex_match_files>": [
"ts-jest",
{
// ts-jest configuration goes here
}
]
}
}
}
export default config
```

:::important
Expand Down
Expand Up @@ -16,8 +16,8 @@ The option is `astTransformers` and it allows ones to specify which 3 types of T

#### Basic Transformers

```js
// jest.config.js
```js tab
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
transform: {
Expand All @@ -33,8 +33,27 @@ module.exports = {
}
```

```json
// OR package.json
```ts tab
import type { JestConfigWithTsJest } from './types'

const jestConfig: JestConfigWithTsJest = {
// [...]
transform: {
'<regex_match_files>': [
'ts-jest',
{
astTransformers: {
before: ['my-custom-transformer'],
},
},
],
},
}

export default jestConfig
```

```JSON tab
{
// [...]
"jest": {
Expand All @@ -54,8 +73,8 @@ module.exports = {

#### Configuring transformers with options

```js
// jest.config.js
```js tab
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
transform: {
Expand All @@ -76,8 +95,32 @@ module.exports = {
}
```

```json
// OR package.json
```ts tab
import type { JestConfigWithTsJest } from './types'

const jestConfig: JestConfigWithTsJest = {
// [...]
transform: {
'<regex_match_files>': [
'ts-jest',
{
astTransformers: {
before: [
{
path: 'my-custom-transformer-that-needs-extra-opts',
options: {}, // extra options to pass to transformers here
},
],
},
},
],
},
}

export default jestConfig
```

```JSON tab
{
// [...]
"jest": {
Expand Down