Skip to content

Commit 038d8be

Browse files
SimenBDan Muller
and
Dan Muller
authored
chore: document haste config option (#10765)
Co-authored-by: Dan Muller <[email protected]>
1 parent 97337d4 commit 038d8be

File tree

11 files changed

+229
-14
lines changed

11 files changed

+229
-14
lines changed

docs/Configuration.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,27 @@ _Note: A global teardown module configured in a project (using multi-project run
464464

465465
_Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._
466466

467+
### `haste` [object]
468+
469+
Default: `undefined`
470+
471+
This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported:
472+
473+
```ts
474+
type HasteConfig = {
475+
// Whether to hash files using SHA-1.
476+
computeSha1?: boolean;
477+
// The platform to use as the default, e.g. 'ios'.
478+
defaultPlatform?: string | null;
479+
// Path to a custom implementation of Haste.
480+
hasteImplModulePath?: string;
481+
// All platforms to target, e.g ['ios', 'android'].
482+
platforms?: Array<string>;
483+
// Whether to throw on error on module collision.
484+
throwOnModuleCollision?: boolean;
485+
};
486+
```
487+
467488
### `injectGlobals` [boolean]
468489

469490
Default: `true`
@@ -1106,7 +1127,7 @@ This option allows the use of a custom results processor. This processor must be
11061127

11071128
```json
11081129
{
1109-
"success": bool,
1130+
"success": boolean,
11101131
"startTime": epoch,
11111132
"numTotalTestSuites": number,
11121133
"numPassedTestSuites": number,

packages/jest-types/src/Config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@ export type Path = string;
1818
export type Glob = string;
1919

2020
export type HasteConfig = {
21+
/** Whether to hash files using SHA-1. */
2122
computeSha1?: boolean;
23+
/** The platform to use as the default, e.g. 'ios'. */
2224
defaultPlatform?: string | null;
25+
/** Path to a custom implementation of Haste. */
2326
hasteImplModulePath?: string;
27+
/** All platforms to target, e.g ['ios', 'android']. */
2428
platforms?: Array<string>;
29+
/** Whether to throw on error on module collision. */
2530
throwOnModuleCollision?: boolean;
2631
};
2732

website/versioned_docs/version-22.x/Configuration.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,27 @@ Default: `undefined`
316316

317317
This option allows the use of a custom global teardown module which exports an async function that is triggered once after all test suites.
318318

319+
### `haste` [object]
320+
321+
Default: `undefined`
322+
323+
This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported:
324+
325+
```ts
326+
type HasteConfig = {
327+
// Whether to hash files using SHA-1.
328+
computeSha1?: boolean;
329+
// The platform to use as the default, e.g. 'ios'.
330+
defaultPlatform?: string | null;
331+
// Path to a custom implementation of Haste.
332+
hasteImplModulePath?: string;
333+
// All platforms to target, e.g ['ios', 'android'].
334+
platforms?: Array<string>;
335+
// Whether to throw on error on module collision.
336+
throwOnModuleCollision?: boolean;
337+
};
338+
```
339+
319340
### `moduleDirectories` [array\<string>]
320341

321342
Default: `["node_modules"]`
@@ -543,7 +564,7 @@ This option allows the use of a custom resolver. This resolver must be a node mo
543564
```json
544565
{
545566
"basedir": string,
546-
"browser": bool,
567+
"browser": boolean,
547568
"extensions": [string],
548569
"moduleDirectory": [string],
549570
"paths": [string],
@@ -835,7 +856,7 @@ This option allows the use of a custom results processor. This processor must be
835856

836857
```json
837858
{
838-
"success": bool,
859+
"success": boolean,
839860
"startTime": epoch,
840861
"numTotalTestSuites": number,
841862
"numPassedTestSuites": number,

website/versioned_docs/version-23.x/Configuration.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,27 @@ Default: `undefined`
336336

337337
This option allows the use of a custom global teardown module which exports an async function that is triggered once after all test suites. This function gets Jest's `globalConfig` object as a parameter.
338338

339+
### `haste` [object]
340+
341+
Default: `undefined`
342+
343+
This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported:
344+
345+
```ts
346+
type HasteConfig = {
347+
// Whether to hash files using SHA-1.
348+
computeSha1?: boolean;
349+
// The platform to use as the default, e.g. 'ios'.
350+
defaultPlatform?: string | null;
351+
// Path to a custom implementation of Haste.
352+
hasteImplModulePath?: string;
353+
// All platforms to target, e.g ['ios', 'android'].
354+
platforms?: Array<string>;
355+
// Whether to throw on error on module collision.
356+
throwOnModuleCollision?: boolean;
357+
};
358+
```
359+
339360
### `moduleDirectories` [array\<string>]
340361

341362
Default: `["node_modules"]`
@@ -569,7 +590,7 @@ This option allows the use of a custom resolver. This resolver must be a node mo
569590
```json
570591
{
571592
"basedir": string,
572-
"browser": bool,
593+
"browser": boolean,
573594
"extensions": [string],
574595
"moduleDirectory": [string],
575596
"paths": [string],
@@ -861,7 +882,7 @@ This option allows the use of a custom results processor. This processor must be
861882

862883
```json
863884
{
864-
"success": bool,
885+
"success": boolean,
865886
"startTime": epoch,
866887
"numTotalTestSuites": number,
867888
"numPassedTestSuites": number,

website/versioned_docs/version-24.x/Configuration.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,27 @@ _Note: A global teardown module configured in a project (using multi-project run
429429

430430
_Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._
431431

432+
### `haste` [object]
433+
434+
Default: `undefined`
435+
436+
This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported:
437+
438+
```ts
439+
type HasteConfig = {
440+
// Whether to hash files using SHA-1.
441+
computeSha1?: boolean;
442+
// The platform to use as the default, e.g. 'ios'.
443+
defaultPlatform?: string | null;
444+
// Path to a custom implementation of Haste.
445+
hasteImplModulePath?: string;
446+
// All platforms to target, e.g ['ios', 'android'].
447+
platforms?: Array<string>;
448+
// Whether to throw on error on module collision.
449+
throwOnModuleCollision?: boolean;
450+
};
451+
```
452+
432453
### `maxConcurrency` [number]
433454

434455
Default: `5`
@@ -668,7 +689,7 @@ This option allows the use of a custom resolver. This resolver must be a node mo
668689
```json
669690
{
670691
"basedir": string,
671-
"browser": bool,
692+
"browser": boolean,
672693
"defaultResolver": "function(request, options)",
673694
"extensions": [string],
674695
"moduleDirectory": [string],
@@ -1002,7 +1023,7 @@ This option allows the use of a custom results processor. This processor must be
10021023

10031024
```json
10041025
{
1005-
"success": bool,
1026+
"success": boolean,
10061027
"startTime": epoch,
10071028
"numTotalTestSuites": number,
10081029
"numPassedTestSuites": number,

website/versioned_docs/version-25.x/Configuration.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,27 @@ _Note: A global teardown module configured in a project (using multi-project run
447447

448448
_Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._
449449

450+
### `haste` [object]
451+
452+
Default: `undefined`
453+
454+
This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported:
455+
456+
```ts
457+
type HasteConfig = {
458+
// Whether to hash files using SHA-1.
459+
computeSha1?: boolean;
460+
// The platform to use as the default, e.g. 'ios'.
461+
defaultPlatform?: string | null;
462+
// Path to a custom implementation of Haste.
463+
hasteImplModulePath?: string;
464+
// All platforms to target, e.g ['ios', 'android'].
465+
platforms?: Array<string>;
466+
// Whether to throw on error on module collision.
467+
throwOnModuleCollision?: boolean;
468+
};
469+
```
470+
450471
### `maxConcurrency` [number]
451472

452473
Default: `5`
@@ -692,7 +713,7 @@ This option allows the use of a custom resolver. This resolver must be a node mo
692713
```json
693714
{
694715
"basedir": string,
695-
"browser": bool,
716+
"browser": boolean,
696717
"defaultResolver": "function(request, options)",
697718
"extensions": [string],
698719
"moduleDirectory": [string],
@@ -1024,7 +1045,7 @@ This option allows the use of a custom results processor. This processor must be
10241045

10251046
```json
10261047
{
1027-
"success": bool,
1048+
"success": boolean,
10281049
"startTime": epoch,
10291050
"numTotalTestSuites": number,
10301051
"numPassedTestSuites": number,

website/versioned_docs/version-26.0/Configuration.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,27 @@ _Note: A global teardown module configured in a project (using multi-project run
437437

438438
_Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._
439439

440+
### `haste` [object]
441+
442+
Default: `undefined`
443+
444+
This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported:
445+
446+
```ts
447+
type HasteConfig = {
448+
// Whether to hash files using SHA-1.
449+
computeSha1?: boolean;
450+
// The platform to use as the default, e.g. 'ios'.
451+
defaultPlatform?: string | null;
452+
// Path to a custom implementation of Haste.
453+
hasteImplModulePath?: string;
454+
// All platforms to target, e.g ['ios', 'android'].
455+
platforms?: Array<string>;
456+
// Whether to throw on error on module collision.
457+
throwOnModuleCollision?: boolean;
458+
};
459+
```
460+
440461
### `maxConcurrency` [number]
441462

442463
Default: `5`
@@ -1024,7 +1045,7 @@ This option allows the use of a custom results processor. This processor must be
10241045

10251046
```json
10261047
{
1027-
"success": bool,
1048+
"success": boolean,
10281049
"startTime": epoch,
10291050
"numTotalTestSuites": number,
10301051
"numPassedTestSuites": number,

website/versioned_docs/version-26.2/Configuration.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,27 @@ _Note: A global teardown module configured in a project (using multi-project run
445445

446446
_Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._
447447

448+
### `haste` [object]
449+
450+
Default: `undefined`
451+
452+
This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported:
453+
454+
```ts
455+
type HasteConfig = {
456+
// Whether to hash files using SHA-1.
457+
computeSha1?: boolean;
458+
// The platform to use as the default, e.g. 'ios'.
459+
defaultPlatform?: string | null;
460+
// Path to a custom implementation of Haste.
461+
hasteImplModulePath?: string;
462+
// All platforms to target, e.g ['ios', 'android'].
463+
platforms?: Array<string>;
464+
// Whether to throw on error on module collision.
465+
throwOnModuleCollision?: boolean;
466+
};
467+
```
468+
448469
### `maxConcurrency` [number]
449470

450471
Default: `5`
@@ -1038,7 +1059,7 @@ This option allows the use of a custom results processor. This processor must be
10381059

10391060
```json
10401061
{
1041-
"success": bool,
1062+
"success": boolean,
10421063
"startTime": epoch,
10431064
"numTotalTestSuites": number,
10441065
"numPassedTestSuites": number,

website/versioned_docs/version-26.4/Configuration.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,27 @@ _Note: A global teardown module configured in a project (using multi-project run
445445

446446
_Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._
447447

448+
### `haste` [object]
449+
450+
Default: `undefined`
451+
452+
This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported:
453+
454+
```ts
455+
type HasteConfig = {
456+
// Whether to hash files using SHA-1.
457+
computeSha1?: boolean;
458+
// The platform to use as the default, e.g. 'ios'.
459+
defaultPlatform?: string | null;
460+
// Path to a custom implementation of Haste.
461+
hasteImplModulePath?: string;
462+
// All platforms to target, e.g ['ios', 'android'].
463+
platforms?: Array<string>;
464+
// Whether to throw on error on module collision.
465+
throwOnModuleCollision?: boolean;
466+
};
467+
```
468+
448469
### `maxConcurrency` [number]
449470

450471
Default: `5`
@@ -1069,7 +1090,7 @@ This option allows the use of a custom results processor. This processor must be
10691090

10701091
```json
10711092
{
1072-
"success": bool,
1093+
"success": boolean,
10731094
"startTime": epoch,
10741095
"numTotalTestSuites": number,
10751096
"numPassedTestSuites": number,

website/versioned_docs/version-26.5/Configuration.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,27 @@ _Note: A global teardown module configured in a project (using multi-project run
445445

446446
_Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._
447447

448+
### `haste` [object]
449+
450+
Default: `undefined`
451+
452+
This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported:
453+
454+
```ts
455+
type HasteConfig = {
456+
// Whether to hash files using SHA-1.
457+
computeSha1?: boolean;
458+
// The platform to use as the default, e.g. 'ios'.
459+
defaultPlatform?: string | null;
460+
// Path to a custom implementation of Haste.
461+
hasteImplModulePath?: string;
462+
// All platforms to target, e.g ['ios', 'android'].
463+
platforms?: Array<string>;
464+
// Whether to throw on error on module collision.
465+
throwOnModuleCollision?: boolean;
466+
};
467+
```
468+
448469
### `injectGlobals` [boolean]
449470

450471
Default: `true`
@@ -1087,7 +1108,7 @@ This option allows the use of a custom results processor. This processor must be
10871108

10881109
```json
10891110
{
1090-
"success": bool,
1111+
"success": boolean,
10911112
"startTime": epoch,
10921113
"numTotalTestSuites": number,
10931114
"numPassedTestSuites": number,

0 commit comments

Comments
 (0)