Skip to content

Commit 4512a96

Browse files
feat: add cli run support for Postman coverage tracking
1 parent 9822e28 commit 4512a96

File tree

6 files changed

+170
-39
lines changed

6 files changed

+170
-39
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
{
22
"name": "api-coverage-tracker",
3-
"version": "1.4.1",
3+
"version": "1.5.0",
44
"description": "A universal library for tracking API coverage against OpenAPI/Swagger specifications from URL or local file. Supports Axis, Fetch, Playwright and manual registry of the responses",
55
"main": "utils/api-coverage.js",
6-
"exports": {
7-
".": "./utils/api-coverage.js"
6+
"bin": {
7+
"api-coverage-tracker": "./utils/cli.js"
88
},
99
"type": "module",
1010
"scripts": {
1111
"test-axios": "node examples/api-coverage-example.js",
1212
"test-playwright": "npx playwright test",
13+
"test-postman": "npx api-coverage-tracker --spec 'https://fakestoreapi.com/fakestoreapi.json' --collection './e2e/data/FakeStoreAPI.postman_collection.json' --coverage detailed",
1314
"lint": "eslint ."
1415
},
1516
"keywords": [

readme.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ It calculates the API testing coverage based on the endpoints, status codes per
2626

2727
For Axios and Fetch clients, it also tracks the previous coverage statistics.
2828

29-
For Postman collections it also tracks the previous coverage statistics.
29+
For Postman collections it also tracks the previous coverage statistics. Supports run from the command line.
3030

3131
## [Coverage Report sample](https://valiantsin2021.github.io/api-coverage-tracker)
3232

@@ -288,7 +288,14 @@ it('API coverage test', () => {
288288
})
289289
```
290290

291-
### Postman example:
291+
### Postman example (cli):
292+
293+
```bash
294+
npx api-coverage-tracker --spec 'https://fakestoreapi.com/fakestoreapi.json' --collection './e2e/data/FakeStoreAPI.postman_collection.json' --coverage basic
295+
296+
```
297+
298+
### Postman example (inline):
292299

293300
```javascript
294301
import config from '../config.json' with { type: 'json' }

reports/index.html

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
}
5555
]
5656
},
57-
"createdAt": "2025-05-31T07:11:45.550Z",
57+
"createdAt": "2025-06-02T20:18:45.104Z",
5858
"servicesCoverage": {
5959
"Fakestore-api-service": {
6060
"endpoints": [
@@ -83,7 +83,7 @@
8383
"totalCoverage": 100,
8484
"totalCoverageHistory": [
8585
{
86-
"createdAt": "2025-05-31T07:11:45.546Z",
86+
"createdAt": "2025-06-02T20:18:45.101Z",
8787
"totalCoverage": 100
8888
}
8989
]
@@ -113,7 +113,7 @@
113113
"totalCoverage": 100,
114114
"totalCoverageHistory": [
115115
{
116-
"createdAt": "2025-05-31T07:11:45.548Z",
116+
"createdAt": "2025-06-02T20:18:45.102Z",
117117
"totalCoverage": 100
118118
}
119119
]
@@ -143,7 +143,7 @@
143143
"totalCoverage": 100,
144144
"totalCoverageHistory": [
145145
{
146-
"createdAt": "2025-05-31T07:11:45.548Z",
146+
"createdAt": "2025-06-02T20:18:45.102Z",
147147
"totalCoverage": 100
148148
}
149149
]
@@ -173,7 +173,7 @@
173173
"totalCoverage": 100,
174174
"totalCoverageHistory": [
175175
{
176-
"createdAt": "2025-05-31T07:11:45.548Z",
176+
"createdAt": "2025-06-02T20:18:45.102Z",
177177
"totalCoverage": 100
178178
}
179179
]
@@ -203,7 +203,7 @@
203203
"totalCoverage": 100,
204204
"totalCoverageHistory": [
205205
{
206-
"createdAt": "2025-05-31T07:11:45.548Z",
206+
"createdAt": "2025-06-02T20:18:45.103Z",
207207
"totalCoverage": 100
208208
}
209209
]
@@ -233,7 +233,7 @@
233233
"totalCoverage": 0,
234234
"totalCoverageHistory": [
235235
{
236-
"createdAt": "2025-05-31T07:11:45.548Z",
236+
"createdAt": "2025-06-02T20:18:45.103Z",
237237
"totalCoverage": 0
238238
}
239239
]
@@ -263,7 +263,7 @@
263263
"totalCoverage": 0,
264264
"totalCoverageHistory": [
265265
{
266-
"createdAt": "2025-05-31T07:11:45.548Z",
266+
"createdAt": "2025-06-02T20:18:45.103Z",
267267
"totalCoverage": 0
268268
}
269269
]
@@ -293,7 +293,7 @@
293293
"totalCoverage": 0,
294294
"totalCoverageHistory": [
295295
{
296-
"createdAt": "2025-05-31T07:11:45.548Z",
296+
"createdAt": "2025-06-02T20:18:45.103Z",
297297
"totalCoverage": 0
298298
}
299299
]
@@ -323,7 +323,7 @@
323323
"totalCoverage": 0,
324324
"totalCoverageHistory": [
325325
{
326-
"createdAt": "2025-05-31T07:11:45.548Z",
326+
"createdAt": "2025-06-02T20:18:45.103Z",
327327
"totalCoverage": 0
328328
}
329329
]
@@ -353,7 +353,7 @@
353353
"totalCoverage": 0,
354354
"totalCoverageHistory": [
355355
{
356-
"createdAt": "2025-05-31T07:11:45.548Z",
356+
"createdAt": "2025-06-02T20:18:45.103Z",
357357
"totalCoverage": 0
358358
}
359359
]
@@ -383,7 +383,7 @@
383383
"totalCoverage": 0,
384384
"totalCoverageHistory": [
385385
{
386-
"createdAt": "2025-05-31T07:11:45.548Z",
386+
"createdAt": "2025-06-02T20:18:45.103Z",
387387
"totalCoverage": 0
388388
}
389389
]
@@ -413,7 +413,7 @@
413413
"totalCoverage": 0,
414414
"totalCoverageHistory": [
415415
{
416-
"createdAt": "2025-05-31T07:11:45.548Z",
416+
"createdAt": "2025-06-02T20:18:45.103Z",
417417
"totalCoverage": 0
418418
}
419419
]
@@ -443,7 +443,7 @@
443443
"totalCoverage": 0,
444444
"totalCoverageHistory": [
445445
{
446-
"createdAt": "2025-05-31T07:11:45.548Z",
446+
"createdAt": "2025-06-02T20:18:45.103Z",
447447
"totalCoverage": 0
448448
}
449449
]
@@ -473,7 +473,7 @@
473473
"totalCoverage": 0,
474474
"totalCoverageHistory": [
475475
{
476-
"createdAt": "2025-05-31T07:11:45.548Z",
476+
"createdAt": "2025-06-02T20:18:45.103Z",
477477
"totalCoverage": 0
478478
}
479479
]
@@ -503,7 +503,7 @@
503503
"totalCoverage": 0,
504504
"totalCoverageHistory": [
505505
{
506-
"createdAt": "2025-05-31T07:11:45.548Z",
506+
"createdAt": "2025-06-02T20:18:45.103Z",
507507
"totalCoverage": 0
508508
}
509509
]
@@ -533,7 +533,7 @@
533533
"totalCoverage": 0,
534534
"totalCoverageHistory": [
535535
{
536-
"createdAt": "2025-05-31T07:11:45.549Z",
536+
"createdAt": "2025-06-02T20:18:45.103Z",
537537
"totalCoverage": 0
538538
}
539539
]
@@ -560,6 +560,26 @@
560560
{
561561
"createdAt": "2025-05-31T07:11:45.549Z",
562562
"totalCoverage": 31.3
563+
},
564+
{
565+
"createdAt": "2025-06-02T20:01:17.387Z",
566+
"totalCoverage": 31.3
567+
},
568+
{
569+
"createdAt": "2025-06-02T20:11:19.839Z",
570+
"totalCoverage": 31.3
571+
},
572+
{
573+
"createdAt": "2025-06-02T20:11:46.917Z",
574+
"totalCoverage": 23.8
575+
},
576+
{
577+
"createdAt": "2025-06-02T20:18:11.797Z",
578+
"totalCoverage": 23.8
579+
},
580+
{
581+
"createdAt": "2025-06-02T20:18:45.103Z",
582+
"totalCoverage": 31.3
563583
}
564584
]
565585
},

0 commit comments

Comments
 (0)