@piyushdoorwar/yamlet 1.0.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 +67 -0
- package/dist/yamlet.js +3607 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @piyushdoorwar/yamlet
|
|
2
|
+
|
|
3
|
+
Run [Yamlet](https://github.com/piyushdoorwar/yamlet) API collections from the command
|
|
4
|
+
line, for example in CI. It fails the build when a request errors, returns a status
|
|
5
|
+
outside 2xx/3xx, or a `pm.test` assertion fails.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @piyushdoorwar/yamlet
|
|
11
|
+
# or run without installing
|
|
12
|
+
npx @piyushdoorwar/yamlet run ./my-workspace
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
It installs the `yamlet` command. Requires Node.js 22 or newer.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
yamlet run <workspace> [options]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`<workspace>` is a Yamlet workspace folder (it contains `collections/` and
|
|
24
|
+
`environments/`), or its parent: the same folder you open in the app. Requests run in
|
|
25
|
+
tree order, collection by collection. Pre-request and post-response scripts run, and
|
|
26
|
+
`pm.test` assertions are counted.
|
|
27
|
+
|
|
28
|
+
| Option | Meaning |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `-e, --env <name\|file>` | Environment to use: a name from the workspace (`dev`) or a path to an environment YAML file |
|
|
31
|
+
| `-g, --globals <file>` | Use these globals instead of the workspace's |
|
|
32
|
+
| `-c, --collection <name>` | Only run this collection (repeat for several) |
|
|
33
|
+
| `-n, --iterations <n>` | Run everything `n` times |
|
|
34
|
+
| `-d, --data <file>` | CSV (with a header row) or JSON array of objects; one iteration per row. Values are available as `{{column}}` and `pm.iterationData.get("column")` |
|
|
35
|
+
| `--delay <ms>` | Wait between requests |
|
|
36
|
+
| `--bail` | Stop after the first failing request |
|
|
37
|
+
| `-r, --reporter <name>` | `table` (default), `json` or `junit` |
|
|
38
|
+
| `-o, --out <file>` | Write the `json` / `junit` report to a file |
|
|
39
|
+
| `--no-color` | Plain output (also honors `NO_COLOR`) |
|
|
40
|
+
|
|
41
|
+
The exit code is `0` when every request passed and `1` otherwise.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
yamlet run ./api --env dev
|
|
45
|
+
yamlet run ./api --env environments/staging.yaml --collection Payments --bail
|
|
46
|
+
yamlet run ./api --env dev --data users.csv --reporter junit --out yamlet-results.xml
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## GitHub Actions
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
- uses: actions/setup-node@v5
|
|
53
|
+
with:
|
|
54
|
+
node-version: 24
|
|
55
|
+
- name: API tests
|
|
56
|
+
run: npx --yes @piyushdoorwar/yamlet run ./api --env ci --reporter junit --out yamlet-results.xml
|
|
57
|
+
- name: Publish results
|
|
58
|
+
if: always()
|
|
59
|
+
uses: actions/upload-artifact@v4
|
|
60
|
+
with:
|
|
61
|
+
name: yamlet-results
|
|
62
|
+
path: yamlet-results.xml
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
MIT
|