Skip to content

Commit 6771bd4

Browse files
jeffgore00SimenB
authored andcommitted
Update docs re: moduleFileExtensions to add ordering note (left-to-right) (#7616)
1 parent 44054af commit 6771bd4

File tree

13 files changed

+27
-25
lines changed

13 files changed

+27
-25
lines changed

docs/Configuration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,9 @@ An array of directory names to be searched recursively up from the requiring mod
409409

410410
Default: `["js", "json", "jsx", "ts", "tsx", "node"]`
411411

412-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
412+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
413+
414+
We recommend placing the extensions most commonly used in your project on the left, so if you are using TypeScript, you may want to consider moving "ts" and/or "tsx" to the beginning of the array.
413415

414416
### `moduleNameMapper` [object<string, string>]
415417

website/versioned_docs/version-22.0/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,9 @@ return {
276276

277277
Default: `["js", "json", "jsx", "node"]`
278278

279-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
279+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
280280

281-
If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest).
281+
If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.
282282

283283
### `moduleDirectories` [array<string>]
284284

website/versioned_docs/version-22.1/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ return {
274274

275275
Default: `["js", "json", "jsx", "node"]`
276276

277-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
277+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
278278

279-
If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest).
279+
If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.
280280

281281
### `moduleDirectories` [array<string>]
282282

website/versioned_docs/version-22.2/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ return {
274274

275275
Default: `["js", "json", "jsx", "node"]`
276276

277-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
277+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
278278

279-
If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest).
279+
If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.
280280

281281
### `moduleDirectories` [array<string>]
282282

website/versioned_docs/version-22.3/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ This option allows the use of a custom global teardown module which exports an a
259259

260260
Default: `["js", "json", "jsx", "node"]`
261261

262-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
262+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
263263

264-
If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest).
264+
If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.
265265

266266
### `moduleDirectories` [array<string>]
267267

website/versioned_docs/version-22.4/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ This option allows the use of a custom global teardown module which exports an a
290290

291291
Default: `["js", "json", "jsx", "node"]`
292292

293-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
293+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
294294

295-
If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest).
295+
If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.
296296

297297
### `moduleDirectories` [array<string>]
298298

website/versioned_docs/version-23.0/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ This option allows the use of a custom global teardown module which exports an a
310310

311311
Default: `["js", "json", "jsx", "node"]`
312312

313-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
313+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
314314

315-
If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest).
315+
If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.
316316

317317
### `moduleDirectories` [array<string>]
318318

website/versioned_docs/version-23.1/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ This option allows the use of a custom global teardown module which exports an a
310310

311311
Default: `["js", "json", "jsx", "node"]`
312312

313-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
313+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
314314

315-
If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest).
315+
If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.
316316

317317
### `moduleDirectories` [array<string>]
318318

website/versioned_docs/version-23.2/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,9 @@ An array of directory names to be searched recursively up from the requiring mod
322322

323323
Default: `["js", "json", "jsx", "node"]`
324324

325-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
325+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
326326

327-
If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest).
327+
If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.
328328

329329
### `moduleNameMapper` [object<string, string>]
330330

website/versioned_docs/version-23.3/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,9 @@ An array of directory names to be searched recursively up from the requiring mod
322322

323323
Default: `["js", "json", "jsx", "node"]`
324324

325-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
325+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
326326

327-
If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest).
327+
If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.
328328

329329
### `moduleNameMapper` [object<string, string>]
330330

website/versioned_docs/version-23.4/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,9 @@ An array of directory names to be searched recursively up from the requiring mod
322322

323323
Default: `["js", "json", "jsx", "node"]`
324324

325-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
325+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
326326

327-
If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest).
327+
If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.
328328

329329
### `moduleNameMapper` [object<string, string>]
330330

website/versioned_docs/version-23.5/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@ An array of directory names to be searched recursively up from the requiring mod
340340

341341
Default: `["js", "json", "jsx", "node"]`
342342

343-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
343+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
344344

345-
If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest).
345+
If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.
346346

347347
### `moduleNameMapper` [object<string, string>]
348348

website/versioned_docs/version-23.6/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@ An array of directory names to be searched recursively up from the requiring mod
340340

341341
Default: `["js", "json", "jsx", "node"]`
342342

343-
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
343+
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.
344344

345-
If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest).
345+
If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.
346346

347347
### `moduleNameMapper` [object<string, string>]
348348

0 commit comments

Comments
 (0)