@requesto/cli 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# @requesto/cli
|
|
2
|
+
|
|
3
|
+
Run your [Requesto](https://requesto.com.au) collections from the terminal and CI pipelines. The test suite you build in the Requesto desktop app (collections, environments, test scripts) becomes the test suite your pipeline runs on every commit.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -D @requesto/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Add a script to your `package.json`:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test:api": "requesto run --environment staging"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or run it straight away:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx requesto run
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## How it works
|
|
28
|
+
|
|
29
|
+
`requesto run` walks up from the current directory until it finds a `.requesto` workspace (created by the [Requesto desktop app](https://github.com/t3rr11/Requesto)), then executes the collections and test scripts inside it with the same engine the app uses: pre-request scripts, variable substitution, OAuth, and `test()`/`expect()` assertions.
|
|
30
|
+
|
|
31
|
+
The run is isolated by construction:
|
|
32
|
+
|
|
33
|
+
- Your `.requesto` workspace is read-only. Script environment changes, request history and OAuth tokens live in memory for the run only.
|
|
34
|
+
- Collections targeting the built-in `{{requestoServerUrl}}` variable run against an ephemeral Requesto server the CLI boots itself (seeded from your workspace on a random local port, torn down afterwards).
|
|
35
|
+
- `--server <url>` tests a deployed Requesto server instead; its active workspace is protected by a scratch workspace for the duration of the run.
|
|
36
|
+
|
|
37
|
+
## Common flags
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
requesto run [PATH] [options]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
| Flag | Description |
|
|
44
|
+
|------|-------------|
|
|
45
|
+
| `-c, --collection <name>` | Run a specific collection (name or id). Repeatable. |
|
|
46
|
+
| `-C, --exclude-collection <name>` | Skip a collection. Repeatable. |
|
|
47
|
+
| `-f, --folder <name>` | Run only a folder and its subfolders. Repeatable. |
|
|
48
|
+
| `-e, --environment <name>` | Environment to use, or `none`. Default: the active environment. |
|
|
49
|
+
| `--var <key=value>` | Override a variable. Repeatable. |
|
|
50
|
+
| `--var-file <path>` | Load variable overrides from a `.env` file. |
|
|
51
|
+
| `--token <configId=token>` | Access token for an OAuth config (e.g. `--token my-entra=eyJ...`). |
|
|
52
|
+
| `--oauth-secret <configId=secret>` | Client secret for non-interactive OAuth flows. |
|
|
53
|
+
| `-x, --bail` | Stop after the first failed or errored request. |
|
|
54
|
+
| `--insecure` | Skip TLS certificate verification. |
|
|
55
|
+
| `--reporter <spec>` | `console` (default), `verbose`, `dot`, `junit:<path>`, `json:<path>`. Repeatable. |
|
|
56
|
+
| `--server <url>` | Test a deployed Requesto server instead of the embedded one. |
|
|
57
|
+
|
|
58
|
+
OAuth configs that normally need a browser fail fast with instructions rather than hanging; your pipeline can supply ready tokens, client secrets or refresh tokens instead. `REQUESTO_TOKEN_*`, `REQUESTO_OAUTH_SECRET_*`, `REQUESTO_REFRESH_TOKEN_*` and `REQUESTO_VAR_*` environment variables mirror the flags.
|
|
59
|
+
|
|
60
|
+
## Exit codes
|
|
61
|
+
|
|
62
|
+
| Code | Meaning |
|
|
63
|
+
|------|---------|
|
|
64
|
+
| `0` | All executed requests passed. |
|
|
65
|
+
| `1` | One or more requests failed their tests, errored, or could not authenticate. |
|
|
66
|
+
| `2` | Configuration error (no workspace found, unknown collection or environment, bad flag values). |
|
|
67
|
+
|
|
68
|
+
## Example pipeline output
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Users API
|
|
72
|
+
✓ List Users (142ms)
|
|
73
|
+
✗ Create User (89ms)
|
|
74
|
+
✗ response has an id: Expected undefined to be defined
|
|
75
|
+
|
|
76
|
+
Failed Requests (1)
|
|
77
|
+
|
|
78
|
+
Users API > Create User
|
|
79
|
+
✗ response has an id: Expected undefined to be defined
|
|
80
|
+
|
|
81
|
+
Requests 1 passed, 1 failed (2 executed)
|
|
82
|
+
Tests 2/3 passed
|
|
83
|
+
Duration 0.24s
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Docker
|
|
87
|
+
|
|
88
|
+
A container image is published alongside the npm package:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
docker run --rm \
|
|
92
|
+
-v "$PWD/.requesto:/work/.requesto" \
|
|
93
|
+
ghcr.io/t3rr11/requesto-cli:latest run --environment staging
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Documentation
|
|
97
|
+
|
|
98
|
+
Full documentation (quickstart, CI authentication with Entra ID, reporters, Docker) can be found on the website under [Requesto CLI](https://requesto.com.au/cli)
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT
|