@testsprite/testsprite-cli 0.2.0 → 0.4.0
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 +35 -26
- package/dist/commands/agent.d.ts +43 -0
- package/dist/commands/agent.js +200 -18
- package/dist/commands/auth.d.ts +5 -0
- package/dist/commands/auth.js +38 -27
- package/dist/commands/doctor.d.ts +49 -0
- package/dist/commands/doctor.js +233 -0
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.js +24 -14
- package/dist/commands/project.d.ts +75 -2
- package/dist/commands/project.js +326 -47
- package/dist/commands/test.d.ts +281 -2
- package/dist/commands/test.js +1658 -177
- package/dist/commands/usage.js +13 -12
- package/dist/index.js +71 -3
- package/dist/lib/agent-targets.d.ts +72 -6
- package/dist/lib/agent-targets.js +188 -6
- package/dist/lib/bundle.d.ts +34 -0
- package/dist/lib/bundle.js +63 -11
- package/dist/lib/client-factory.d.ts +31 -0
- package/dist/lib/client-factory.js +63 -0
- package/dist/lib/config.d.ts +2 -0
- package/dist/lib/config.js +11 -2
- package/dist/lib/credentials.js +10 -1
- package/dist/lib/dry-run/samples.d.ts +5 -0
- package/dist/lib/dry-run/samples.js +64 -0
- package/dist/lib/errors.d.ts +28 -1
- package/dist/lib/errors.js +40 -0
- package/dist/lib/failing-fe-resolver.d.ts +15 -0
- package/dist/lib/failing-fe-resolver.js +49 -1
- package/dist/lib/flaky.d.ts +80 -0
- package/dist/lib/flaky.js +76 -0
- package/dist/lib/http.d.ts +73 -1
- package/dist/lib/http.js +327 -135
- package/dist/lib/interrupt.d.ts +116 -0
- package/dist/lib/interrupt.js +182 -0
- package/dist/lib/junit-report.d.ts +58 -0
- package/dist/lib/junit-report.js +210 -0
- package/dist/lib/output.d.ts +16 -1
- package/dist/lib/output.js +24 -2
- package/dist/lib/pagination.d.ts +4 -3
- package/dist/lib/pagination.js +34 -6
- package/dist/lib/poll.d.ts +11 -0
- package/dist/lib/poll.js +70 -5
- package/dist/lib/prompt.js +52 -8
- package/dist/lib/proxy.d.ts +29 -0
- package/dist/lib/proxy.js +30 -0
- package/dist/lib/render-error.js +3 -1
- package/dist/lib/runs.types.d.ts +9 -0
- package/dist/lib/skill-nudge.d.ts +2 -2
- package/dist/lib/skill-nudge.js +13 -4
- package/dist/lib/target-url.js +8 -1
- package/dist/lib/ticker.d.ts +11 -1
- package/dist/lib/ticker.js +33 -1
- package/dist/lib/update-check.d.ts +67 -0
- package/dist/lib/update-check.js +246 -0
- package/dist/lib/v3-advisory.d.ts +13 -0
- package/dist/lib/v3-advisory.js +24 -0
- package/dist/lib/version-notice.d.ts +37 -0
- package/dist/lib/version-notice.js +87 -0
- package/dist/version-guard.d.ts +33 -0
- package/dist/version-guard.js +39 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -2
- package/skills/testsprite-onboard.skill.md +21 -0
- package/skills/testsprite-verify.codex.md +6 -0
- package/skills/testsprite-verify.skill.md +48 -4
|
@@ -21,6 +21,17 @@ Run the loop only once the change is live somewhere reachable (e.g. open the PR,
|
|
|
21
21
|
let CI deploy the preview/staging environment) and pass that URL as
|
|
22
22
|
`--target-url`. Running earlier verifies the previous build, not your change.
|
|
23
23
|
|
|
24
|
+
This CLI only tests a reachable deployed URL (it rejects localhost). If the
|
|
25
|
+
change is only running locally and isn't deployed anywhere reachable yet:
|
|
26
|
+
|
|
27
|
+
- if the TestSprite MCP is available in this environment, hand off to it — it
|
|
28
|
+
tunnels your local server and tests the running app;
|
|
29
|
+
- otherwise report the change as unverified-because-undeployed and stop — don't
|
|
30
|
+
run against a stale deployment to manufacture a verdict.
|
|
31
|
+
|
|
32
|
+
If the user explicitly named a tool (the CLI or the MCP), honor that over this
|
|
33
|
+
reachability heuristic.
|
|
34
|
+
|
|
24
35
|
## When to skip
|
|
25
36
|
|
|
26
37
|
The skip list is narrow:
|
|
@@ -165,6 +176,39 @@ only the Python **standard library + `requests` + `pytest` + `numpy` + `scipy`**
|
|
|
165
176
|
- Get values from the API's responses (and captured variables), not by importing and
|
|
166
177
|
calling the app's internals.
|
|
167
178
|
|
|
179
|
+
**Authentication — read the injected credential, NEVER hardcode any credential.** This
|
|
180
|
+
applies to **every** secret the API needs — Bearer/JWT tokens **and** API keys, basic-auth
|
|
181
|
+
blobs, session cookies. Do not paste a literal `Bearer …`, `sk-…`, `x-api-key` value, or any
|
|
182
|
+
other credential into the test. Before your script runs, TestSprite prepends a managed
|
|
183
|
+
credential block built from the project's Authentication settings, and `__AUTH_HEADERS__`
|
|
184
|
+
already contains the right header(s) for the configured auth type:
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
# Auto-injected credentials — do not modify
|
|
188
|
+
__AUTH_CREDENTIAL__ = "..."
|
|
189
|
+
__AUTH_TYPE__ = "Bearer token" # or "API key" / "basic token" / "public"
|
|
190
|
+
__AUTH_HEADERS__ = {"Authorization": "Bearer ..."} # API key → {"X-API-Key": "..."}; basic → {"Authorization": "Basic ..."}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Spread `__AUTH_HEADERS__` into every authenticated request — it adapts to whatever auth type
|
|
194
|
+
the project is configured for, so the same line works for Bearer, API-key, or basic auth:
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
r = requests.get(f"{TARGET_URL}/profile", headers={**__AUTH_HEADERS__})
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Configure the credential **once on the project** (ask the user for the value — never invent
|
|
201
|
+
or reuse a key you happened to see), and the block stays correct + refreshable:
|
|
202
|
+
|
|
203
|
+
- **Bearer / API key / basic (static):**
|
|
204
|
+
`testsprite project credential <projectId> --type "Bearer token"|"API key"|"basic token" --credential <value>`
|
|
205
|
+
- **Auto-refreshing login (recurring token):** `testsprite project auto-auth <projectId> …`
|
|
206
|
+
|
|
207
|
+
A hardcoded token expires within hours (and a hardcoded key can't be rotated centrally), so
|
|
208
|
+
the test breaks on later runs; the managed block is rewritten with a fresh value each run.
|
|
209
|
+
`test create` emits a `[warn]` when it detects an inlined credential literal — treat that as
|
|
210
|
+
a must-fix, not a nuisance.
|
|
211
|
+
|
|
168
212
|
**Backend tests that share state declare dependencies at create time.** For a
|
|
169
213
|
one-off verification, prefer a single self-contained script (log in inside the
|
|
170
214
|
same file). But when the coverage set splits naturally into producer → consumer
|
|
@@ -192,10 +236,10 @@ testsprite test create --type backend --project <projectId> --name "fixture user
|
|
|
192
236
|
ordering: trigger the set with `test run --all` (§4) and producers run before
|
|
193
237
|
consumers, `teardown` last. Chaining `run A --wait && run B --wait` yourself
|
|
194
238
|
loses the engine's variable passing and conflicts with concurrent runs.
|
|
195
|
-
- **Declarations are
|
|
196
|
-
`
|
|
197
|
-
|
|
198
|
-
|
|
239
|
+
- **Declarations are editable.** `test update` amends them (`--produces` /
|
|
240
|
+
`--needs` / `--category`, repeatable) and `test get` echoes them back —
|
|
241
|
+
still declare the graph at create time when you can, so wave ordering is
|
|
242
|
+
right on the first run.
|
|
199
243
|
|
|
200
244
|
**Show the user the drafted plan / code before creating it** — creating writes to
|
|
201
245
|
their project. One short confirmation; let them edit the tempfile first.
|