Skip to content

Commit 96aece6

Browse files
authored
Update README.md
1 parent eab9ef3 commit 96aece6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ $ npm install endpoint-coverage --save-dev
1212
There is one main function exported in the module, `coverageMiddleware`.
1313

1414
### `coverageMiddleware`
15-
[Express.js](https://expressjs.com) middleware that collects all HTTP requests made against the server. Scans all request handlers registered in the application and use them for comparison when collecting the coverage.
15+
[Express.js](https://expressjs.com) middleware that collects all HTTP requests made against the server. Scans all request handlers registered in the application and pre-attaches middleware checking whether the given handler was called.
1616

1717
Registers endpoint (`GET /collectCoverage`) for collecting the coverage.
1818

19-
Middleware should be registered only in the test environment.
19+
Middleware has to be registered only in the test environment.
2020

2121

2222
```ts
@@ -38,7 +38,7 @@ const app = express();
3838
const port = 12345;
3939

4040
if(isTestEnv()) {
41-
app.use(coverageMiddleware);
41+
app.use(coverageMiddleware());
4242
}
4343

4444
app.get('/path/:param', () => {...});
@@ -56,4 +56,4 @@ afterAll(async () => {
5656
const coverageResult: CoverageResult = await fetch('/coverageResult');
5757
expect(coverageResult.notCoveredRoutes).toBeEmpty();
5858
});
59-
```
59+
```

0 commit comments

Comments
 (0)