Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions apps/api-runner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# @mydevtools/api-runner

Headless runner for [mydevtools](https://mydevtools.tech) API client collections — Postman / Newman compatible.

Same scripts, same `pm.*` API, same JUnit output as the web runner.

## Install

```bash
npm i -g @mydevtools/api-runner
```

## Run

```bash
mydevtools-api run my-collection.json
mydevtools-api run my-collection.json --env prod.env.json --data users.csv
mydevtools-api run my-collection.json --reporter junit --reporter-out report.xml --bail
```

## Flags

| Flag | Description |
|---|---|
| `--data <file>` | CSV or JSON-array data file. One iteration per row; row keys override `{{vars}}`. |
| `--env <file>` | Postman Environment v2 export. Enabled values become the base `{{var}}` map. |
| `--iterations <N>` | Iterations when no data file is given. Default 1. |
| `--reporter <name>` | `cli` (default) or `junit`. |
| `--reporter-out <path>` | Required for `--reporter junit`. |
| `--bail` | Stop on the first failing assertion / network error. |

## Exit codes

| Code | Meaning |
|---|---|
| 0 | All tests passed |
| 1 | Some tests / requests failed |
| 2 | Usage error |

## Differences vs the web runner (v0.1)

- No cookie jar (Node `fetch` has no jar) — provide auth via env vars.
- No OAuth refresh flow — pre-mint a bearer token and put it in env.
- No SSE / streaming (the web has `/api/proxy-stream`; the CLI does plain `await response.text()`).
- No GraphQL introspection.

Everything else — scripts, env mutations, `{{response.body.x}}` chaining,
folder inheritance, data-driven iterations, JUnit XML — matches the web runner
bit-for-bit.
3 changes: 3 additions & 0 deletions apps/api-runner/dist/csv.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/** Same CSV/JSON data-file parser as the web app — verbatim port for portability. */
export declare function parseCsv(text: string): Record<string, string>[];
export declare function parseDataFile(text: string): Record<string, string>[];
77 changes: 77 additions & 0 deletions apps/api-runner/dist/csv.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/api-runner/dist/csv.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions apps/api-runner/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env node
/**
* mydevtools-api CLI.
* Headless equivalent of the web-side collection runner. Same scripts, same
* substitution layering, same JUnit output — runs over a Postman v2.1 export.
*/
export {};
133 changes: 133 additions & 0 deletions apps/api-runner/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/api-runner/dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions apps/api-runner/dist/junit.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/** JUnit XML emitter — port of `apps/web/src/lib/runner/junit.ts`. */
import type { RequestRunResult } from "./types.js";
export declare function buildJUnitXml(results: RequestRunResult[], suiteName: string): string;
Loading