You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/development-environment.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,3 +99,29 @@ Common PHPUnit arguments:
99
99
-`--exclude-group`: Exclude tests with a specific @group annotation
100
100
-`--verbose`: Output more verbose information
101
101
-`--debug`: Display debugging information
102
+
103
+
### Code Coverage Reports
104
+
105
+
The coverage configuration is already set up in `phpunit.xml.dist` to analyze the code in the `includes` directory. To generate code coverage reports, you'll need to start wp-env with Xdebug enabled for coverage:
106
+
107
+
```bash
108
+
# Start the environment with Xdebug enabled.
109
+
npm run env -- start --xdebug=coverage
110
+
```
111
+
```bash
112
+
# Run tests with code coverage.
113
+
npm run env-test -- --coverage-text
114
+
```
115
+
116
+
The above will display a text-based coverage report in your terminal. For a more detailed HTML report:
117
+
118
+
```bash
119
+
# Generate HTML coverage report in Docker.
120
+
npm run env-test -- --coverage-html ./coverage
121
+
```
122
+
```bash
123
+
# Open the coverage report in your default browser (macOS).
124
+
open coverage/index.html
125
+
```
126
+
127
+
The HTML report will be generated directly in the `coverage` directory in your local filesystem. The `index.html` file can then be opened in a browser, showing a detailed analysis of which lines of code are covered by tests.
0 commit comments