diff --git a/docs/generated/packages/jest/documents/overview.md b/docs/generated/packages/jest/documents/overview.md index 2012ffe1f091b..7923cb998e1e2 100644 --- a/docs/generated/packages/jest/documents/overview.md +++ b/docs/generated/packages/jest/documents/overview.md @@ -161,6 +161,16 @@ To run Jest tests via nx use nx test frontend ``` +### Testing Specific Files + +Using a single positional argument or the `--testFile` flag will run all test files matching the regex. For more info check out the [Jest documentation](https://jestjs.io/docs/cli#jest-regexfortestfiles). + +```shell +nx test frontend HomePage.tsx +# or +nx test frontend --testFile HomePage.tsx +``` + ### Watching for Changes Using the `--watch` flag will run the tests whenever a file changes. diff --git a/docs/generated/packages/jest/executors/jest.json b/docs/generated/packages/jest/executors/jest.json index 07818365c09ae..321c0d1e222c2 100644 --- a/docs/generated/packages/jest/executors/jest.json +++ b/docs/generated/packages/jest/executors/jest.json @@ -51,7 +51,8 @@ }, "testFile": { "description": "The name of the file to test.", - "type": "string" + "type": "string", + "$default": { "$source": "argv", "index": 0 } }, "tsConfig": { "description": "The name of the Typescript configuration file.", diff --git a/docs/shared/packages/jest/jest-plugin.md b/docs/shared/packages/jest/jest-plugin.md index 2012ffe1f091b..7923cb998e1e2 100644 --- a/docs/shared/packages/jest/jest-plugin.md +++ b/docs/shared/packages/jest/jest-plugin.md @@ -161,6 +161,16 @@ To run Jest tests via nx use nx test frontend ``` +### Testing Specific Files + +Using a single positional argument or the `--testFile` flag will run all test files matching the regex. For more info check out the [Jest documentation](https://jestjs.io/docs/cli#jest-regexfortestfiles). + +```shell +nx test frontend HomePage.tsx +# or +nx test frontend --testFile HomePage.tsx +``` + ### Watching for Changes Using the `--watch` flag will run the tests whenever a file changes. diff --git a/packages/jest/src/executors/jest/schema.json b/packages/jest/src/executors/jest/schema.json index 3c1aed561e417..708e33a399c4c 100644 --- a/packages/jest/src/executors/jest/schema.json +++ b/packages/jest/src/executors/jest/schema.json @@ -53,7 +53,11 @@ }, "testFile": { "description": "The name of the file to test.", - "type": "string" + "type": "string", + "$default": { + "$source": "argv", + "index": 0 + } }, "tsConfig": { "description": "The name of the Typescript configuration file.",