From 038d8beef2b4514feb777ee909bd6c5a273e06f1 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 2 Nov 2020 09:21:43 +0100 Subject: [PATCH] chore: document `haste` config option (#10765) Co-authored-by: Dan Muller --- docs/Configuration.md | 23 ++++++++++++++++- packages/jest-types/src/Config.ts | 5 ++++ .../version-22.x/Configuration.md | 25 +++++++++++++++++-- .../version-23.x/Configuration.md | 25 +++++++++++++++++-- .../version-24.x/Configuration.md | 25 +++++++++++++++++-- .../version-25.x/Configuration.md | 25 +++++++++++++++++-- .../version-26.0/Configuration.md | 23 ++++++++++++++++- .../version-26.2/Configuration.md | 23 ++++++++++++++++- .../version-26.4/Configuration.md | 23 ++++++++++++++++- .../version-26.5/Configuration.md | 23 ++++++++++++++++- .../version-26.6/Configuration.md | 23 ++++++++++++++++- 11 files changed, 229 insertions(+), 14 deletions(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index dd3cc6901e1b..c34bebedfcdf 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -464,6 +464,27 @@ _Note: A global teardown module configured in a project (using multi-project run _Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._ +### `haste` [object] + +Default: `undefined` + +This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported: + +```ts +type HasteConfig = { + // Whether to hash files using SHA-1. + computeSha1?: boolean; + // The platform to use as the default, e.g. 'ios'. + defaultPlatform?: string | null; + // Path to a custom implementation of Haste. + hasteImplModulePath?: string; + // All platforms to target, e.g ['ios', 'android']. + platforms?: Array; + // Whether to throw on error on module collision. + throwOnModuleCollision?: boolean; +}; +``` + ### `injectGlobals` [boolean] Default: `true` @@ -1106,7 +1127,7 @@ This option allows the use of a custom results processor. This processor must be ```json { - "success": bool, + "success": boolean, "startTime": epoch, "numTotalTestSuites": number, "numPassedTestSuites": number, diff --git a/packages/jest-types/src/Config.ts b/packages/jest-types/src/Config.ts index 114d69a0df36..cf48b24c66d6 100644 --- a/packages/jest-types/src/Config.ts +++ b/packages/jest-types/src/Config.ts @@ -18,10 +18,15 @@ export type Path = string; export type Glob = string; export type HasteConfig = { + /** Whether to hash files using SHA-1. */ computeSha1?: boolean; + /** The platform to use as the default, e.g. 'ios'. */ defaultPlatform?: string | null; + /** Path to a custom implementation of Haste. */ hasteImplModulePath?: string; + /** All platforms to target, e.g ['ios', 'android']. */ platforms?: Array; + /** Whether to throw on error on module collision. */ throwOnModuleCollision?: boolean; }; diff --git a/website/versioned_docs/version-22.x/Configuration.md b/website/versioned_docs/version-22.x/Configuration.md index 9735599f0571..5573979baabc 100644 --- a/website/versioned_docs/version-22.x/Configuration.md +++ b/website/versioned_docs/version-22.x/Configuration.md @@ -316,6 +316,27 @@ Default: `undefined` This option allows the use of a custom global teardown module which exports an async function that is triggered once after all test suites. +### `haste` [object] + +Default: `undefined` + +This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported: + +```ts +type HasteConfig = { + // Whether to hash files using SHA-1. + computeSha1?: boolean; + // The platform to use as the default, e.g. 'ios'. + defaultPlatform?: string | null; + // Path to a custom implementation of Haste. + hasteImplModulePath?: string; + // All platforms to target, e.g ['ios', 'android']. + platforms?: Array; + // Whether to throw on error on module collision. + throwOnModuleCollision?: boolean; +}; +``` + ### `moduleDirectories` [array\] Default: `["node_modules"]` @@ -543,7 +564,7 @@ This option allows the use of a custom resolver. This resolver must be a node mo ```json { "basedir": string, - "browser": bool, + "browser": boolean, "extensions": [string], "moduleDirectory": [string], "paths": [string], @@ -835,7 +856,7 @@ This option allows the use of a custom results processor. This processor must be ```json { - "success": bool, + "success": boolean, "startTime": epoch, "numTotalTestSuites": number, "numPassedTestSuites": number, diff --git a/website/versioned_docs/version-23.x/Configuration.md b/website/versioned_docs/version-23.x/Configuration.md index 063882407883..9009bf609e95 100644 --- a/website/versioned_docs/version-23.x/Configuration.md +++ b/website/versioned_docs/version-23.x/Configuration.md @@ -336,6 +336,27 @@ Default: `undefined` 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. +### `haste` [object] + +Default: `undefined` + +This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported: + +```ts +type HasteConfig = { + // Whether to hash files using SHA-1. + computeSha1?: boolean; + // The platform to use as the default, e.g. 'ios'. + defaultPlatform?: string | null; + // Path to a custom implementation of Haste. + hasteImplModulePath?: string; + // All platforms to target, e.g ['ios', 'android']. + platforms?: Array; + // Whether to throw on error on module collision. + throwOnModuleCollision?: boolean; +}; +``` + ### `moduleDirectories` [array\] Default: `["node_modules"]` @@ -569,7 +590,7 @@ This option allows the use of a custom resolver. This resolver must be a node mo ```json { "basedir": string, - "browser": bool, + "browser": boolean, "extensions": [string], "moduleDirectory": [string], "paths": [string], @@ -861,7 +882,7 @@ This option allows the use of a custom results processor. This processor must be ```json { - "success": bool, + "success": boolean, "startTime": epoch, "numTotalTestSuites": number, "numPassedTestSuites": number, diff --git a/website/versioned_docs/version-24.x/Configuration.md b/website/versioned_docs/version-24.x/Configuration.md index 265d9238e7b6..791b8bdbcf96 100644 --- a/website/versioned_docs/version-24.x/Configuration.md +++ b/website/versioned_docs/version-24.x/Configuration.md @@ -429,6 +429,27 @@ _Note: A global teardown module configured in a project (using multi-project run _Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._ +### `haste` [object] + +Default: `undefined` + +This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported: + +```ts +type HasteConfig = { + // Whether to hash files using SHA-1. + computeSha1?: boolean; + // The platform to use as the default, e.g. 'ios'. + defaultPlatform?: string | null; + // Path to a custom implementation of Haste. + hasteImplModulePath?: string; + // All platforms to target, e.g ['ios', 'android']. + platforms?: Array; + // Whether to throw on error on module collision. + throwOnModuleCollision?: boolean; +}; +``` + ### `maxConcurrency` [number] Default: `5` @@ -668,7 +689,7 @@ This option allows the use of a custom resolver. This resolver must be a node mo ```json { "basedir": string, - "browser": bool, + "browser": boolean, "defaultResolver": "function(request, options)", "extensions": [string], "moduleDirectory": [string], @@ -1002,7 +1023,7 @@ This option allows the use of a custom results processor. This processor must be ```json { - "success": bool, + "success": boolean, "startTime": epoch, "numTotalTestSuites": number, "numPassedTestSuites": number, diff --git a/website/versioned_docs/version-25.x/Configuration.md b/website/versioned_docs/version-25.x/Configuration.md index aa08f7439c6c..3979c208ce4d 100644 --- a/website/versioned_docs/version-25.x/Configuration.md +++ b/website/versioned_docs/version-25.x/Configuration.md @@ -447,6 +447,27 @@ _Note: A global teardown module configured in a project (using multi-project run _Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._ +### `haste` [object] + +Default: `undefined` + +This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported: + +```ts +type HasteConfig = { + // Whether to hash files using SHA-1. + computeSha1?: boolean; + // The platform to use as the default, e.g. 'ios'. + defaultPlatform?: string | null; + // Path to a custom implementation of Haste. + hasteImplModulePath?: string; + // All platforms to target, e.g ['ios', 'android']. + platforms?: Array; + // Whether to throw on error on module collision. + throwOnModuleCollision?: boolean; +}; +``` + ### `maxConcurrency` [number] Default: `5` @@ -692,7 +713,7 @@ This option allows the use of a custom resolver. This resolver must be a node mo ```json { "basedir": string, - "browser": bool, + "browser": boolean, "defaultResolver": "function(request, options)", "extensions": [string], "moduleDirectory": [string], @@ -1024,7 +1045,7 @@ This option allows the use of a custom results processor. This processor must be ```json { - "success": bool, + "success": boolean, "startTime": epoch, "numTotalTestSuites": number, "numPassedTestSuites": number, diff --git a/website/versioned_docs/version-26.0/Configuration.md b/website/versioned_docs/version-26.0/Configuration.md index 7b55d763daa7..e82591733803 100644 --- a/website/versioned_docs/version-26.0/Configuration.md +++ b/website/versioned_docs/version-26.0/Configuration.md @@ -437,6 +437,27 @@ _Note: A global teardown module configured in a project (using multi-project run _Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._ +### `haste` [object] + +Default: `undefined` + +This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported: + +```ts +type HasteConfig = { + // Whether to hash files using SHA-1. + computeSha1?: boolean; + // The platform to use as the default, e.g. 'ios'. + defaultPlatform?: string | null; + // Path to a custom implementation of Haste. + hasteImplModulePath?: string; + // All platforms to target, e.g ['ios', 'android']. + platforms?: Array; + // Whether to throw on error on module collision. + throwOnModuleCollision?: boolean; +}; +``` + ### `maxConcurrency` [number] Default: `5` @@ -1024,7 +1045,7 @@ This option allows the use of a custom results processor. This processor must be ```json { - "success": bool, + "success": boolean, "startTime": epoch, "numTotalTestSuites": number, "numPassedTestSuites": number, diff --git a/website/versioned_docs/version-26.2/Configuration.md b/website/versioned_docs/version-26.2/Configuration.md index ee944bba2183..ccc1a0b0e5c6 100644 --- a/website/versioned_docs/version-26.2/Configuration.md +++ b/website/versioned_docs/version-26.2/Configuration.md @@ -445,6 +445,27 @@ _Note: A global teardown module configured in a project (using multi-project run _Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._ +### `haste` [object] + +Default: `undefined` + +This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported: + +```ts +type HasteConfig = { + // Whether to hash files using SHA-1. + computeSha1?: boolean; + // The platform to use as the default, e.g. 'ios'. + defaultPlatform?: string | null; + // Path to a custom implementation of Haste. + hasteImplModulePath?: string; + // All platforms to target, e.g ['ios', 'android']. + platforms?: Array; + // Whether to throw on error on module collision. + throwOnModuleCollision?: boolean; +}; +``` + ### `maxConcurrency` [number] Default: `5` @@ -1038,7 +1059,7 @@ This option allows the use of a custom results processor. This processor must be ```json { - "success": bool, + "success": boolean, "startTime": epoch, "numTotalTestSuites": number, "numPassedTestSuites": number, diff --git a/website/versioned_docs/version-26.4/Configuration.md b/website/versioned_docs/version-26.4/Configuration.md index fd052bbafc3d..16762c6cebc3 100644 --- a/website/versioned_docs/version-26.4/Configuration.md +++ b/website/versioned_docs/version-26.4/Configuration.md @@ -445,6 +445,27 @@ _Note: A global teardown module configured in a project (using multi-project run _Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._ +### `haste` [object] + +Default: `undefined` + +This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported: + +```ts +type HasteConfig = { + // Whether to hash files using SHA-1. + computeSha1?: boolean; + // The platform to use as the default, e.g. 'ios'. + defaultPlatform?: string | null; + // Path to a custom implementation of Haste. + hasteImplModulePath?: string; + // All platforms to target, e.g ['ios', 'android']. + platforms?: Array; + // Whether to throw on error on module collision. + throwOnModuleCollision?: boolean; +}; +``` + ### `maxConcurrency` [number] Default: `5` @@ -1069,7 +1090,7 @@ This option allows the use of a custom results processor. This processor must be ```json { - "success": bool, + "success": boolean, "startTime": epoch, "numTotalTestSuites": number, "numPassedTestSuites": number, diff --git a/website/versioned_docs/version-26.5/Configuration.md b/website/versioned_docs/version-26.5/Configuration.md index 4c5554dfcd9e..0057d145f34c 100644 --- a/website/versioned_docs/version-26.5/Configuration.md +++ b/website/versioned_docs/version-26.5/Configuration.md @@ -445,6 +445,27 @@ _Note: A global teardown module configured in a project (using multi-project run _Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._ +### `haste` [object] + +Default: `undefined` + +This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported: + +```ts +type HasteConfig = { + // Whether to hash files using SHA-1. + computeSha1?: boolean; + // The platform to use as the default, e.g. 'ios'. + defaultPlatform?: string | null; + // Path to a custom implementation of Haste. + hasteImplModulePath?: string; + // All platforms to target, e.g ['ios', 'android']. + platforms?: Array; + // Whether to throw on error on module collision. + throwOnModuleCollision?: boolean; +}; +``` + ### `injectGlobals` [boolean] Default: `true` @@ -1087,7 +1108,7 @@ This option allows the use of a custom results processor. This processor must be ```json { - "success": bool, + "success": boolean, "startTime": epoch, "numTotalTestSuites": number, "numPassedTestSuites": number, diff --git a/website/versioned_docs/version-26.6/Configuration.md b/website/versioned_docs/version-26.6/Configuration.md index 3882466520bf..97599b753416 100644 --- a/website/versioned_docs/version-26.6/Configuration.md +++ b/website/versioned_docs/version-26.6/Configuration.md @@ -465,6 +465,27 @@ _Note: A global teardown module configured in a project (using multi-project run _Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._ +### `haste` [object] + +Default: `undefined` + +This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported: + +```ts +type HasteConfig = { + // Whether to hash files using SHA-1. + computeSha1?: boolean; + // The platform to use as the default, e.g. 'ios'. + defaultPlatform?: string | null; + // Path to a custom implementation of Haste. + hasteImplModulePath?: string; + // All platforms to target, e.g ['ios', 'android']. + platforms?: Array; + // Whether to throw on error on module collision. + throwOnModuleCollision?: boolean; +}; +``` + ### `injectGlobals` [boolean] Default: `true` @@ -1107,7 +1128,7 @@ This option allows the use of a custom results processor. This processor must be ```json { - "success": bool, + "success": boolean, "startTime": epoch, "numTotalTestSuites": number, "numPassedTestSuites": number,