Skip to content

Commit 8881e06

Browse files
committed
Update readme file with usage of new flag
1 parent 1984ee3 commit 8881e06

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ Options:
5858
--debug Run tests in debug mode
5959
(https://jestjs.io/docs/en/troubleshooting)
6060
[boolean] [default: false]
61+
--projectJson Path to the project JSON file (defaults to
62+
sfdx-project.json) [string]
6163
--help Show help [boolean]
6264
6365
Examples:
64-
sfdx-lwc-jest --coverage Collect coverage and display in output
65-
sfdx-lwc-jest -- --json All params after `--` are directly passed to Jest
66+
sfdx-lwc-jest --coverage Collect coverage and display in output
67+
sfdx-lwc-jest --projectJson my.json Use custom project file
68+
sfdx-lwc-jest -- --json All params after `--` are directly passed to Jest
6669
```
6770

6871
## Passing Additional Jest CLI Options
@@ -75,6 +78,22 @@ sfdx-lwc-jest -- --json
7578

7679
See the [Jest documentation](http://facebook.github.io/jest/docs/en/cli.html) for all CLI options.
7780

81+
## Custom Project Configuration
82+
83+
By default, `sfdx-lwc-jest` looks for `sfdx-project.json` in the current working directory to discover LWC component paths. You can specify a custom project JSON file using the `--projectJson` option:
84+
85+
```bash
86+
sfdx-lwc-jest --projectJson ./configs/my-project.json
87+
```
88+
89+
This is useful for:
90+
91+
- Projects with non-standard project file names
92+
- Testing against multiple project configurations
93+
- CI/CD pipelines with custom project setups
94+
95+
The custom project file should follow the same format as `sfdx-project.json` with `packageDirectories` containing paths to your LWC components.
96+
7897
## Debug Mode
7998

8099
Debug mode lets you easily debug your Jest tests.

0 commit comments

Comments
 (0)