From 63ee20beb67234febe5e5053ca5d7fb6bcc7be47 Mon Sep 17 00:00:00 2001 From: OlliMartin Date: Thu, 6 Feb 2025 22:03:04 +0100 Subject: [PATCH 1/4] Extend heft-jest-plugin configuration schema --- .../src/schemas/heft-jest-plugin.schema.json | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/heft-plugins/heft-jest-plugin/src/schemas/heft-jest-plugin.schema.json b/heft-plugins/heft-jest-plugin/src/schemas/heft-jest-plugin.schema.json index 4b11df53547..ad7ea4d9417 100644 --- a/heft-plugins/heft-jest-plugin/src/schemas/heft-jest-plugin.schema.json +++ b/heft-plugins/heft-jest-plugin/src/schemas/heft-jest-plugin.schema.json @@ -7,6 +7,16 @@ "additionalProperties": false, "properties": { + "configurationPath": { + "title": "Path to Jest configuration file", + "description": "If provided, this path will be used to load Jest configuration. Otherwise, Jest configuration will be loaded from \"jest.config.json\".", + "type": "string" + }, + "disableCodeCoverage": { + "title": "Disable Code Coverage", + "description": "Disable any configured code coverage. If code coverage is not configured, this parameter has no effect.", + "type": "boolean" + }, "disableConfigurationModuleResolution": { "title": "Disable Configuration Module Resolution", "description": "If set to true, modules specified in the Jest configuration will be resolved using Jest default (rootDir-relative) resolution. Otherwise, modules will be resolved using Node module resolution.", @@ -16,6 +26,51 @@ "title": "Enable management of the NODE_ENV variable", "description": "If set to false, heft-jest-plugin will not set or unset the NODE_ENV variable. Otherwise, NODE_ENV will be set to `test` before execution and cleared after. If the NODE_ENV value is already set to a value that is not `test`, warning message appears.", "type": "boolean" + }, + "findRelatedTests": { + "title": "Find tests related to file", + "description": "Find and run the tests that cover the source file that is specified. This corresponds to the \"--findRelatedTests\" parameter in Jest\"s documentation. This parameter is not compatible with watch mode.", + "type": "string" + }, + "maxWorkers": { + "title": "Maximum number of worker processes", + "description": "Use this parameter to control maximum number of worker processes tests are allowed to use. This parameter is similar to the parameter noted in the Jest documentation, and can either be an integer representing the number of workers to spawn when running tests, or can be a string representing a percentage of the available CPUs on the machine to utilize. Example values: \"3\", \"25%\"", + "type": "string" + }, + "passWithNoTests": { + "title": "Pass with no tests", + "description": "If set to false, Jest will fail if no tests are found.", + "type": "boolean" + }, + "silent": { + "title": "Disable console output", + "description": "Prevent tests from printing messages through the console. This corresponds to the \"--silent\" parameter in Jest\"s documentation.", + "type": "boolean" + }, + "testNamePattern": { + "title": "Test Name Pattern", + "description": "Run only tests with a name that matches a regular expression. On Windows you will need to use \"/\" instead of \"\\\". This corresponds to the \"--testNamePattern\" parameter in Jest\"s documentation.", + "type": "string" + }, + "testPathIgnorePatterns": { + "title": "Test Path Ignore Patterns", + "description": "Avoid running tests with a source file path that matches one ore more regular expressions. On Windows you will need to use \"/\" instead of \"\\\". This corresponds to the \"--testPathIgnorePatterns\" parameter in Jest\"s documentation.", + "type": "string" + }, + "testPathPattern": { + "title": "Test Path Pattern", + "description": "Run only tests with a source file path that matches a regular expression. On Windows you will need to use \"/\" instead of \"\\\". This corresponds to the \"--testPathPattern\" parameter in Jest\"s documentation.", + "type": "string" + }, + "testTimeout": { + "title": "Test Timeout", + "description": "Change the default timeout for tests; if a test doesn\"t complete within this many milliseconds, it will fail. Individual tests can override the default. If unspecified, the default is normally 5000 ms. This corresponds to the \"--testTimeout\" parameter in Jest\"s documentation.", + "type": "number" + }, + "updateSnapshots": { + "title": "Update Snapshots", + "description": "Update Jest snapshots while running the tests. This corresponds to the \"--updateSnapshots\" parameter in Jest.", + "type": "boolean" } } } From 90592906a107c660c29df33d049da192748caec6 Mon Sep 17 00:00:00 2001 From: Olli Martin <25843194+OlliMartin@users.noreply.github.com> Date: Thu, 6 Feb 2025 22:07:14 +0100 Subject: [PATCH 2/4] Bump versions [skip ci] --- ...IncorrectHeftJsonPluginSchema_2025-02-06-21-03.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@rushstack/heft-jest-plugin/bugfix-IncorrectHeftJsonPluginSchema_2025-02-06-21-03.json diff --git a/common/changes/@rushstack/heft-jest-plugin/bugfix-IncorrectHeftJsonPluginSchema_2025-02-06-21-03.json b/common/changes/@rushstack/heft-jest-plugin/bugfix-IncorrectHeftJsonPluginSchema_2025-02-06-21-03.json new file mode 100644 index 00000000000..3d6202fcf3e --- /dev/null +++ b/common/changes/@rushstack/heft-jest-plugin/bugfix-IncorrectHeftJsonPluginSchema_2025-02-06-21-03.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@rushstack/heft-jest-plugin", + "comment": "Extend heft-jest-plugin json schema to match HeftJestConfiguration", + "type": "patch" + } + ], + "packageName": "@rushstack/heft-jest-plugin" +} \ No newline at end of file From bb362338271c9f734db7ff3611382fb7730a84bb Mon Sep 17 00:00:00 2001 From: Olli Martin <25843194+OlliMartin@users.noreply.github.com> Date: Thu, 6 Feb 2025 22:50:25 +0100 Subject: [PATCH 3/4] PR comments --- .../src/schemas/heft-jest-plugin.schema.json | 54 +------------------ 1 file changed, 2 insertions(+), 52 deletions(-) diff --git a/heft-plugins/heft-jest-plugin/src/schemas/heft-jest-plugin.schema.json b/heft-plugins/heft-jest-plugin/src/schemas/heft-jest-plugin.schema.json index ad7ea4d9417..20e11b5ac11 100644 --- a/heft-plugins/heft-jest-plugin/src/schemas/heft-jest-plugin.schema.json +++ b/heft-plugins/heft-jest-plugin/src/schemas/heft-jest-plugin.schema.json @@ -9,7 +9,7 @@ "properties": { "configurationPath": { "title": "Path to Jest configuration file", - "description": "If provided, this path will be used to load Jest configuration. Otherwise, Jest configuration will be loaded from \"jest.config.json\".", + "description": "If provided, this path will be used to load Jest configuration. Otherwise, Jest configuration will be loaded from \"/config/jest.config.json\".", "type": "string" }, "disableCodeCoverage": { @@ -21,56 +21,6 @@ "title": "Disable Configuration Module Resolution", "description": "If set to true, modules specified in the Jest configuration will be resolved using Jest default (rootDir-relative) resolution. Otherwise, modules will be resolved using Node module resolution.", "type": "boolean" - }, - "enableNodeEnvManagement": { - "title": "Enable management of the NODE_ENV variable", - "description": "If set to false, heft-jest-plugin will not set or unset the NODE_ENV variable. Otherwise, NODE_ENV will be set to `test` before execution and cleared after. If the NODE_ENV value is already set to a value that is not `test`, warning message appears.", - "type": "boolean" - }, - "findRelatedTests": { - "title": "Find tests related to file", - "description": "Find and run the tests that cover the source file that is specified. This corresponds to the \"--findRelatedTests\" parameter in Jest\"s documentation. This parameter is not compatible with watch mode.", - "type": "string" - }, - "maxWorkers": { - "title": "Maximum number of worker processes", - "description": "Use this parameter to control maximum number of worker processes tests are allowed to use. This parameter is similar to the parameter noted in the Jest documentation, and can either be an integer representing the number of workers to spawn when running tests, or can be a string representing a percentage of the available CPUs on the machine to utilize. Example values: \"3\", \"25%\"", - "type": "string" - }, - "passWithNoTests": { - "title": "Pass with no tests", - "description": "If set to false, Jest will fail if no tests are found.", - "type": "boolean" - }, - "silent": { - "title": "Disable console output", - "description": "Prevent tests from printing messages through the console. This corresponds to the \"--silent\" parameter in Jest\"s documentation.", - "type": "boolean" - }, - "testNamePattern": { - "title": "Test Name Pattern", - "description": "Run only tests with a name that matches a regular expression. On Windows you will need to use \"/\" instead of \"\\\". This corresponds to the \"--testNamePattern\" parameter in Jest\"s documentation.", - "type": "string" - }, - "testPathIgnorePatterns": { - "title": "Test Path Ignore Patterns", - "description": "Avoid running tests with a source file path that matches one ore more regular expressions. On Windows you will need to use \"/\" instead of \"\\\". This corresponds to the \"--testPathIgnorePatterns\" parameter in Jest\"s documentation.", - "type": "string" - }, - "testPathPattern": { - "title": "Test Path Pattern", - "description": "Run only tests with a source file path that matches a regular expression. On Windows you will need to use \"/\" instead of \"\\\". This corresponds to the \"--testPathPattern\" parameter in Jest\"s documentation.", - "type": "string" - }, - "testTimeout": { - "title": "Test Timeout", - "description": "Change the default timeout for tests; if a test doesn\"t complete within this many milliseconds, it will fail. Individual tests can override the default. If unspecified, the default is normally 5000 ms. This corresponds to the \"--testTimeout\" parameter in Jest\"s documentation.", - "type": "number" - }, - "updateSnapshots": { - "title": "Update Snapshots", - "description": "Update Jest snapshots while running the tests. This corresponds to the \"--updateSnapshots\" parameter in Jest.", - "type": "boolean" } } -} +} \ No newline at end of file From 5ff36637417b2650132be088daac7153e8e0554c Mon Sep 17 00:00:00 2001 From: Olli Martin <25843194+OlliMartin@users.noreply.github.com> Date: Thu, 6 Feb 2025 22:51:18 +0100 Subject: [PATCH 4/4] Change wrong parameter --- .../src/schemas/heft-jest-plugin.schema.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/heft-plugins/heft-jest-plugin/src/schemas/heft-jest-plugin.schema.json b/heft-plugins/heft-jest-plugin/src/schemas/heft-jest-plugin.schema.json index 20e11b5ac11..a7abe910c37 100644 --- a/heft-plugins/heft-jest-plugin/src/schemas/heft-jest-plugin.schema.json +++ b/heft-plugins/heft-jest-plugin/src/schemas/heft-jest-plugin.schema.json @@ -12,15 +12,15 @@ "description": "If provided, this path will be used to load Jest configuration. Otherwise, Jest configuration will be loaded from \"/config/jest.config.json\".", "type": "string" }, - "disableCodeCoverage": { - "title": "Disable Code Coverage", - "description": "Disable any configured code coverage. If code coverage is not configured, this parameter has no effect.", - "type": "boolean" - }, "disableConfigurationModuleResolution": { "title": "Disable Configuration Module Resolution", "description": "If set to true, modules specified in the Jest configuration will be resolved using Jest default (rootDir-relative) resolution. Otherwise, modules will be resolved using Node module resolution.", "type": "boolean" + }, + "enableNodeEnvManagement": { + "title": "Enable management of the NODE_ENV variable", + "description": "If set to false, heft-jest-plugin will not set or unset the NODE_ENV variable. Otherwise, NODE_ENV will be set to `test` before execution and cleared after. If the NODE_ENV value is already set to a value that is not `test`, warning message appears.", + "type": "boolean" } } } \ No newline at end of file