wayfarer-cli 0.0.0-stage → 2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ashwin Sathian
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,231 @@
1
- # Temporary Holding Version
1
+ # wayfarer-cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Run a [Wayfarer](https://wayfarer.ashwinsathian.com) or Postman collection
4
+ from a terminal or a CI job. The command line sends with the same engine as
5
+ the Wayfarer app: the same script sandbox, variables, vault and assertions.
6
+ A run here gives the results the same run gives in the app, and a test in the
7
+ repository checks that in Chromium, Firefox and WebKit.
8
+
9
+ ```bash
10
+ npx wayfarer-cli run orders.postman_collection.json -e local.postman_environment.json --allow-scripts
11
+ ```
12
+
13
+ ```
14
+ ✓ Create order: 200 OK, 16 ms
15
+ ✓ status is 200
16
+ ✓ the SKU was sent
17
+ ✓ Fetch order: 200 OK, 2 ms
18
+ ✓ the SKU came back
19
+
20
+ 2 results in 1 iteration; 0 failed; 3 of 3 tests passed.
21
+ ```
22
+
23
+ When a test fails, the line says what was expected, and the exit code is `1`:
24
+
25
+ ```
26
+ ✗ Fetch order: 200 OK, 3 ms
27
+ ✗ the SKU came back: expected 'ABC-2' to deeply equal 'ABC-1'
28
+
29
+ 2 results in 1 iteration; 1 failed; 2 of 3 tests passed.
30
+ ```
31
+
32
+ ## Install
33
+
34
+ It needs Node.js 22.12 or later. Run it with `npx`, or install it:
35
+
36
+ ```bash
37
+ npm install --global wayfarer-cli
38
+ wayfarer-cli --version
39
+ ```
40
+
41
+ In a project, add it as a dev dependency and pin the major version
42
+ (`wayfarer-cli@2`): a new major version may change what a run does.
43
+
44
+ ## What it runs
45
+
46
+ ```bash
47
+ wayfarer-cli run <file> [options]
48
+ ```
49
+
50
+ `<file>` can be any of:
51
+
52
+ - a Wayfarer collection (Export in the app);
53
+ - a Wayfarer workspace backup (Settings → Backup). It brings its active
54
+ environment, its globals and its vault. A backup with several collections
55
+ needs `--collection <name>`;
56
+ - a Postman collection, v2.0 or v2.1;
57
+ - an Insomnia export or an OpenAPI description, read the way the app
58
+ imports them.
59
+
60
+ ## Options
61
+
62
+ | Option | What it does |
63
+ |---|---|
64
+ | `-e`, `--environment <file>` | The variables: a Wayfarer environments file or a Postman environment. |
65
+ | `-d`, `--data <file>` | A data file, CSV or JSON. Each row is one iteration. |
66
+ | `-n`, `--iterations <n>` | How many iterations. Default: one per row of the data file, or 1. |
67
+ | `--collection <name>` | Which collection to run, from a file that holds several. |
68
+ | `--reporter <list>` | `cli`, `json`, `junit`, comma-separated. Default `cli`. |
69
+ | `--out <dir>` | Where `json` and `junit` reports go. Default: the current folder. |
70
+ | `--bail` | Stop at the first failure. |
71
+ | `--timeout <ms>` | Give up on a request after this long. Default: no limit. |
72
+ | `--insecure` | Don't verify TLS certificates, for every request of the run. |
73
+ | `--allow-scripts` | Run the file's scripts (see below). |
74
+ | `--vault-file <file>` | A vault exported from the app, for requests that use a vault secret. |
75
+ | `-v`, `--version` | Print the version. |
76
+ | `-h`, `--help` | Print the usage. |
77
+
78
+ ### Exit codes
79
+
80
+ | Code | Meaning |
81
+ |---|---|
82
+ | `0` | Every request got a response and every test passed. |
83
+ | `1` | A test failed, a request got no response, or a script ended in an error. |
84
+ | `2` | Nothing was run. The message on stderr says why. |
85
+
86
+ ## Scripts run only when you allow them
87
+
88
+ In the app, scripts from an imported file run only after you've read them and
89
+ marked them as trusted. A file passed to the command line has had no such
90
+ review, so a collection with any pre-request or post-response script is not
91
+ run until you add `--allow-scripts`:
92
+
93
+ ```
94
+ $ npx wayfarer-cli run orders.postman_collection.json -e local.postman_environment.json
95
+ This collection has scripts, in the request "Create order", the request "Fetch order". A file's scripts have not been reviewed: read them, and run again with --allow-scripts only if you trust them. Nothing was sent.
96
+ ```
97
+
98
+ That run exits `2`. With the flag, every script in the file runs in QuickJS
99
+ (compiled to WebAssembly), with the same allow-list of globals as the app.
100
+ There is no `process`, and `require` gives only the five bundled libraries
101
+ (chai, crypto-js, lodash, moment, uuid), so a script can't read your files or
102
+ environment variables. It can still send
103
+ requests of its own with `pm.sendRequest` and change the request it belongs
104
+ to, so read a file's scripts before you allow them.
105
+
106
+ What `pm` supports is listed row by row in
107
+ [docs/postman-compatibility.md](https://github.com/AshwinSathian/wayfarer/blob/main/docs/postman-compatibility.md).
108
+ That file is generated from the cases the test suite runs.
109
+
110
+ ## Coming from Newman
111
+
112
+ Most flags carry over:
113
+
114
+ | Newman | wayfarer-cli |
115
+ |---|---|
116
+ | `newman run c.json` | `wayfarer-cli run c.json` (add `--allow-scripts` if it has scripts) |
117
+ | `-e env.json` | `-e env.json` |
118
+ | `-d data.csv` | `-d data.csv` |
119
+ | `-n 3` | `-n 3` |
120
+ | `--bail` | `--bail` |
121
+ | `--timeout-request 5000` | `--timeout 5000` |
122
+ | `-k`, `--insecure` | `--insecure` |
123
+ | `-r cli,junit --reporter-junit-export out/report.xml` | `--reporter cli,junit --out out` (the file is `wayfarer-run.junit.xml`) |
124
+
125
+ Not supported: a globals file (`-g`), `--env-var`, and running a single
126
+ folder (`--folder`). Put those values in the environment file, or use a
127
+ workspace backup, which carries its globals.
128
+
129
+ The order of a run follows Newman, including `setNextRequest`, skipped
130
+ requests and data-file iterations. That order is checked against
131
+ golden files written by Newman.
132
+
133
+ ## Reports
134
+
135
+ `--reporter json` writes `wayfarer-run.json` and `--reporter junit` writes
136
+ `wayfarer-run.junit.xml`, the same files the app's run view saves. Both go
137
+ in `--out`, which is created if it doesn't exist (2.0.1 and later). The
138
+ JUnit file has one `<testsuite>` per request and one `<testcase>` per test:
139
+
140
+ ```xml
141
+ <testsuites name="Orders API" tests="3" failures="0" errors="0" time="0.019">
142
+ <testsuite name="Create order" id="01a2e75e-…" tests="2" failures="0" errors="0" skipped="0" time="0.016">
143
+ <testcase name="status is 200" classname="Create order"/>
144
+ <testcase name="the SKU was sent" classname="Create order"/>
145
+ </testsuite>
146
+ …
147
+ </testsuites>
148
+ ```
149
+
150
+ ## Secrets and the vault
151
+
152
+ A Wayfarer variable can be protected: its value is a reference to a secret
153
+ in the app's encrypted vault, written `{{$secret.<id>}}`. A request that
154
+ uses one needs the vault. A workspace backup includes it, or `--vault-file`
155
+ names one exported from the app. The passphrase comes from the
156
+ `WAYFARER_VAULT_PASSPHRASE` environment variable, never from an argument,
157
+ because other users of the machine can see a process's arguments.
158
+
159
+ Without the vault, such a request isn't sent: a secret's reference never goes
160
+ out as text. Secrets are masked in both reports, as they are in the app's
161
+ history. When a script sets a protected variable, the new value lasts for the
162
+ rest of the run; the vault file isn't written.
163
+
164
+ The app asks before a pre-request script sends a request with a vault secret
165
+ to a different host. Nobody can answer that in a terminal, so the answer is
166
+ no: the request isn't sent, and the run ends with the reason.
167
+
168
+ ## In CI
169
+
170
+ A GitHub Actions job that runs a collection on every push, keeps the JUnit
171
+ report and fails when a test fails:
172
+
173
+ ```yaml
174
+ name: API tests
175
+ on: [push]
176
+ jobs:
177
+ api:
178
+ runs-on: ubuntu-latest
179
+ steps:
180
+ - uses: actions/checkout@v5
181
+ - uses: actions/setup-node@v5
182
+ with:
183
+ node-version: 24
184
+ - name: Run the collection
185
+ run: npx --yes wayfarer-cli@2 run api/collection.json -e api/ci.environment.json --allow-scripts --reporter cli,junit --out reports
186
+ env:
187
+ # Only needed for requests that use a vault secret.
188
+ WAYFARER_VAULT_PASSPHRASE: ${{ secrets.WAYFARER_VAULT_PASSPHRASE }}
189
+ - uses: actions/upload-artifact@v4
190
+ if: always()
191
+ with:
192
+ name: api-report
193
+ path: reports/wayfarer-run.junit.xml
194
+ ```
195
+
196
+ Every release is published from this repository's
197
+ [`release.yml`](https://github.com/AshwinSathian/wayfarer/blob/main/.github/workflows/release.yml)
198
+ with an npm provenance attestation. `npm audit signatures` in a project that
199
+ installs it checks the attestation.
200
+
201
+ ## Where requests go
202
+
203
+ Every request goes straight from Node. Node has no CORS, no mixed-content
204
+ rule and no forbidden headers, so a route set in the app (Auto, Local
205
+ Bridge) is ignored here, and nothing is ever sent twice.
206
+
207
+ For a proxy, set `NODE_USE_ENV_PROXY=1` together with `HTTPS_PROXY`,
208
+ `HTTP_PROXY` and `NO_PROXY`. That is Node's own proxy support, in Node 22.21
209
+ and 24.5 and later.
210
+
211
+ ## Not supported
212
+
213
+ - **OAuth 2.0 tokens.** A request with OAuth 2.0 auth isn't sent, and the
214
+ result says so. Get the token in an earlier CI step and pass it as a
215
+ variable.
216
+ - **Files in a request body.** A file you pick in the app stays in that
217
+ browser and isn't in the collection file, so such a request isn't sent.
218
+ - **Cookies.** There's no cookie jar: a request carries only the cookies
219
+ it sets itself.
220
+ - **Event streams and WebSockets.** An event stream is read as one body
221
+ when it ends, so give a `--timeout` for one that doesn't end. A `ws:` or
222
+ `wss:` address gets no response.
223
+
224
+ The full guide is
225
+ [docs/cli.md](https://github.com/AshwinSathian/wayfarer/blob/main/docs/cli.md).
226
+
227
+ ## Licence
228
+
229
+ MIT. The packages bundled into `dist/wayfarer-cli.mjs` are listed with their
230
+ licences in `dist/THIRD_PARTY_LICENSES.txt`. The script engine,
231
+ `quickjs-emscripten`, is an ordinary dependency and carries its own.
@@ -0,0 +1,186 @@
1
+ wayfarer-cli bundles the packages below. The script engine (quickjs-emscripten) is a dependency and carries its own.
2
+
3
+ --------------------------------------------------------------------------------
4
+ @noble/hashes@2.4.0 (MIT)
5
+
6
+ The MIT License (MIT)
7
+
8
+ Copyright (c) 2022 Paul Miller (https://paulmillr.com)
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the “Software”), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
+ THE SOFTWARE.
27
+
28
+ --------------------------------------------------------------------------------
29
+ yaml@2.9.1 (ISC)
30
+
31
+ Copyright Eemeli Aro <eemeli@gmail.com>
32
+
33
+ Permission to use, copy, modify, and/or distribute this software for any purpose
34
+ with or without fee is hereby granted, provided that the above copyright notice
35
+ and this permission notice appear in all copies.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
38
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
39
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
40
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
41
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
42
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
43
+ THIS SOFTWARE.
44
+
45
+ --------------------------------------------------------------------------------
46
+ Run inside the script engine: chai@6.3.0 (MIT)
47
+
48
+ MIT License
49
+
50
+ Copyright (c) 2017 Chai.js Assertion Library
51
+
52
+ Permission is hereby granted, free of charge, to any person obtaining a copy
53
+ of this software and associated documentation files (the "Software"), to deal
54
+ in the Software without restriction, including without limitation the rights
55
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
56
+ copies of the Software, and to permit persons to whom the Software is
57
+ furnished to do so, subject to the following conditions:
58
+
59
+ The above copyright notice and this permission notice shall be included in all
60
+ copies or substantial portions of the Software.
61
+
62
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
63
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
64
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
65
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
66
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
67
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
68
+ SOFTWARE.
69
+
70
+ --------------------------------------------------------------------------------
71
+ Run inside the script engine: crypto-js@4.2.0 (MIT)
72
+
73
+ # License
74
+
75
+ [The MIT License (MIT)](http://opensource.org/licenses/MIT)
76
+
77
+ Copyright (c) 2009-2013 Jeff Mott
78
+ Copyright (c) 2013-2016 Evan Vosberg
79
+
80
+ Permission is hereby granted, free of charge, to any person obtaining a copy
81
+ of this software and associated documentation files (the "Software"), to deal
82
+ in the Software without restriction, including without limitation the rights
83
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
84
+ copies of the Software, and to permit persons to whom the Software is
85
+ furnished to do so, subject to the following conditions:
86
+
87
+ The above copyright notice and this permission notice shall be included in
88
+ all copies or substantial portions of the Software.
89
+
90
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
91
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
92
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
93
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
94
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
95
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
96
+ THE SOFTWARE.
97
+
98
+ --------------------------------------------------------------------------------
99
+ Run inside the script engine: lodash@4.18.1 (MIT)
100
+
101
+ Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
102
+
103
+ Based on Underscore.js, copyright Jeremy Ashkenas,
104
+ DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
105
+
106
+ This software consists of voluntary contributions made by many
107
+ individuals. For exact contribution history, see the revision history
108
+ available at https://github.com/lodash/lodash
109
+
110
+ The following license applies to all parts of this software except as
111
+ documented below:
112
+
113
+ ====
114
+
115
+ Permission is hereby granted, free of charge, to any person obtaining
116
+ a copy of this software and associated documentation files (the
117
+ "Software"), to deal in the Software without restriction, including
118
+ without limitation the rights to use, copy, modify, merge, publish,
119
+ distribute, sublicense, and/or sell copies of the Software, and to
120
+ permit persons to whom the Software is furnished to do so, subject to
121
+ the following conditions:
122
+
123
+ The above copyright notice and this permission notice shall be
124
+ included in all copies or substantial portions of the Software.
125
+
126
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
127
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
128
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
129
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
130
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
131
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
132
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
133
+
134
+ ====
135
+
136
+ Copyright and related rights for sample code are waived via CC0. Sample
137
+ code is defined as all source code displayed within the prose of the
138
+ documentation.
139
+
140
+ CC0: http://creativecommons.org/publicdomain/zero/1.0/
141
+
142
+ ====
143
+
144
+ Files located in the node_modules and vendor directories are externally
145
+ maintained libraries used by this software which have their own
146
+ licenses; we recommend you read them, as their terms may differ from the
147
+ terms above.
148
+
149
+ --------------------------------------------------------------------------------
150
+ Run inside the script engine: moment@2.31.0 (MIT)
151
+
152
+ Copyright (c) OpenJS Foundation and other contributors
153
+
154
+ Permission is hereby granted, free of charge, to any person
155
+ obtaining a copy of this software and associated documentation
156
+ files (the "Software"), to deal in the Software without
157
+ restriction, including without limitation the rights to use,
158
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
159
+ copies of the Software, and to permit persons to whom the
160
+ Software is furnished to do so, subject to the following
161
+ conditions:
162
+
163
+ The above copyright notice and this permission notice shall be
164
+ included in all copies or substantial portions of the Software.
165
+
166
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
167
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
168
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
169
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
170
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
171
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
172
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
173
+ OTHER DEALINGS IN THE SOFTWARE.
174
+
175
+ --------------------------------------------------------------------------------
176
+ Run inside the script engine: uuid@14.0.3 (MIT)
177
+
178
+ The MIT License (MIT)
179
+
180
+ Copyright (c) 2010-2020 Robert Kieffer and other contributors
181
+
182
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
183
+
184
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
185
+
186
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.