Skip to content

Commit

Permalink
docs: add file name for Prism code block
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl committed Jun 16, 2024
1 parent a5f3c8a commit 9ceb9ac
Show file tree
Hide file tree
Showing 73 changed files with 252 additions and 90 deletions.
3 changes: 3 additions & 0 deletions website/docs/getting-started/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All `ts-jest` specific options can be defined in Jest `transform` config object
or through a `jest.config.js`, or `jest.config.ts` file.

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

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

const jestConfig: JestConfigWithTsJest = {
Expand All @@ -50,6 +52,7 @@ const jestConfig: JestConfigWithTsJest = {
```

```JSON tab
// package.json
{
// [...]
"jest": {
Expand Down
6 changes: 6 additions & 0 deletions website/docs/getting-started/options/astTransformers.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The option is `astTransformers` and it allows ones to specify which 3 types of T
#### Basic Transformers

```js tab
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
Expand All @@ -36,6 +37,7 @@ module.exports = {
```

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

const jestConfig: JestConfigWithTsJest = {
Expand All @@ -58,6 +60,7 @@ export default jestConfig
```

```JSON tab
// package.json
{
// [...]
"jest": {
Expand All @@ -80,6 +83,7 @@ export default jestConfig
#### Configuring transformers with options

```js tab
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
Expand All @@ -104,6 +108,7 @@ module.exports = {
```

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

const jestConfig: JestConfigWithTsJest = {
Expand Down Expand Up @@ -131,6 +136,7 @@ export default jestConfig
```

```JSON tab
// package.json
{
// [...]
"jest": {
Expand Down
12 changes: 11 additions & 1 deletion website/docs/getting-started/options/babelConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The option is `babelConfig` and it works pretty much as the `tsconfig` option, e
#### Use default `babelrc` file

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

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

const jestConfig: JestConfigWithTsJest = {
Expand All @@ -52,7 +54,7 @@ export default jestConfig
```

```JSON tab
// OR package.json
// package.json
{
// [...]
"jest": {
Expand All @@ -75,6 +77,7 @@ export default jestConfig
The path should be relative to the current working directory where you start Jest from. You can also use `\<rootDir>` in the path, or use an absolute path (this last one is strongly not recommended).

```js tab
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
Expand All @@ -92,6 +95,7 @@ module.exports = {
```

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

const jestConfig: JestConfigWithTsJest = {
Expand All @@ -112,6 +116,7 @@ export default jestConfig
```

```JSON tab
// package.json
{
// [...]
"jest": {
Expand All @@ -132,6 +137,7 @@ export default jestConfig
or importing directly the config file:

```js tab
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
Expand All @@ -149,6 +155,7 @@ module.exports = {
```

```ts tab
// jest.config.ts
import type { JestConfigWithTsJest } from 'ts-jest'
import babelConfig from './babelrc.test.js'

Expand All @@ -174,6 +181,7 @@ export default jestConfig
Refer to the [Babel options](https://babeljs.io/docs/en/next/options) to know what can be used there.

```js tab
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
Expand All @@ -194,6 +202,7 @@ module.exports = {
```

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

const jestConfig: JestConfigWithTsJest = {
Expand All @@ -217,6 +226,7 @@ export default jestConfig
```

```JSON tab
// package.json
{
// [...]
"jest": {
Expand Down
3 changes: 3 additions & 0 deletions website/docs/getting-started/options/compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ If you use a custom compiler, such as `ttypescript`, make sure its API is the sa
### Example

```js tab
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
Expand All @@ -29,6 +30,7 @@ module.exports = {
```

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

const jestConfig: JestConfigWithTsJest = {
Expand All @@ -49,6 +51,7 @@ export default jestConfig
```

```JSON tab
// package.json
{
// [...]
"jest": {
Expand Down
13 changes: 12 additions & 1 deletion website/docs/getting-started/options/diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ The `diagnostics` option's value can also accept an object for more advanced con
#### Disabling diagnostics

```js tab
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
Expand All @@ -49,6 +50,7 @@ module.exports = {
```

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

const jestConfig: JestConfigWithTsJest = {
Expand All @@ -69,6 +71,7 @@ export default jestConfig
```

```JSON tab
// package.json
{
// [...]
"jest": {
Expand All @@ -93,6 +96,7 @@ export default jestConfig
Assuming all your test files ends with `.spec.ts` or `.test.ts`, using the following config will enable error reporting only for those files:

```js tab
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
Expand All @@ -112,6 +116,7 @@ module.exports = {
```

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

const jestConfig: JestConfigWithTsJest = {
Expand All @@ -134,7 +139,7 @@ export default jestConfig
```

```JSON tab
// OR package.json
// package.json
{
// [...]
"jest": {
Expand All @@ -159,6 +164,7 @@ export default jestConfig
While some diagnostics are stop-blockers for the compilation, most of them are not. If you want the compilation (and so your tests) to continue when encountering those, set the `warnOnly` to `true`:

```js tab
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
Expand All @@ -178,6 +184,7 @@ module.exports = {
```

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

const jestConfig: JestConfigWithTsJest = {
Expand All @@ -200,6 +207,7 @@ export default jestConfig
```

```JSON tab
// package.json
{
// [...]
"jest": {
Expand Down Expand Up @@ -229,6 +237,7 @@ All TypeScript error codes can be found [there](https://github.com/Microsoft/Typ
4. An `array` of one or more from `1` or `3` (example: `[1009, "TS2571", "6031"]`)

```js tab
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
Expand All @@ -248,6 +257,7 @@ module.exports = {
```

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

const jestConfig: JestConfigWithTsJest = {
Expand All @@ -270,6 +280,7 @@ export default jestConfig
```

```JSON tab
// package.json
{
// [...]
"jest": {
Expand Down
3 changes: 3 additions & 0 deletions website/docs/getting-started/options/isolatedModules.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Here is how to disable type-checking and compile each file as an isolated module
### Example

```js tab
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
// [...]
Expand All @@ -30,6 +31,7 @@ module.exports = {
```

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

const jestConfig: JestConfigWithTsJest = {
Expand All @@ -50,6 +52,7 @@ export default jestConfig
```

```JSON tab
// package.json
{
// [...]
"jest": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Let's say for example that you have a file `foo.ts` which contains `export defau
In the `jest.config.js` version, you could do as in the `package.json` version of the config, but extending from the preset will ensure more compatibility without any changes when updating.

```js tab
// jest.config.js
const { defaults: tsjPreset } = require('ts-jest/presets')

/** @type {import('ts-jest').JestConfigWithTsJest} */
Expand All @@ -34,6 +35,7 @@ module.exports = {
```

```ts tab
// jest.config.ts
import type { JestConfigWithTsJest } from 'ts-jest'
import tsJestPresets from 'ts-jest/presets'

Expand All @@ -53,6 +55,7 @@ const jestConfig: JestConfigWithTsJest = {
```

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

0 comments on commit 9ceb9ac

Please sign in to comment.