@bachsproof/cli 1.1.0 → 2.0.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 +21 -42
- package/dist/cli.js +215 -321
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +25 -29
- package/dist/index.js +150 -248
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,49 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@bachsproof/cli`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The CLI is the supported BachsProof v2 entry point.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
```bash
|
|
6
|
+
pnpm add -D @bachsproof/cli
|
|
7
|
+
pnpm exec bachsproof init
|
|
8
|
+
pnpm exec bachsproof test
|
|
9
|
+
```
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
`init` creates one `bachsproof.config.mjs` file. The file contains the complete
|
|
12
|
+
webhook URL, test signing secret, amount, currency, `createPayment()`, and
|
|
13
|
+
`verify()` callbacks. The CLI configures the Bachs adapter, webhook signing,
|
|
14
|
+
the eleven scenarios, ordinary concurrent delivery, and mandatory financial
|
|
15
|
+
verification automatically.
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
application repository:
|
|
17
|
+
The same config object works in Vitest, Jest, or a custom script:
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- `tests/bachsproof.test.mjs` with all 15 supported scenario definitions;
|
|
18
|
-
- `tests/bachsproof.setup.mjs` for the optional `createPayment(context)` callback;
|
|
19
|
-
- `tests/bachsproof.verify.mjs` for the `verify(reference, context)` callback.
|
|
19
|
+
```js
|
|
20
|
+
import { loadConfig, runConfig, summarizeRuns } from "@bachsproof/cli";
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
const config = await loadConfig("bachsproof.config.mjs");
|
|
23
|
+
const results = await runConfig(config);
|
|
24
|
+
console.log(summarizeRuns(results));
|
|
25
|
+
```
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
application owns test payment preparation, isolation, cleanup, and committed
|
|
27
|
-
state access.
|
|
28
|
-
|
|
29
|
-
Real application references are the default. Use `createPayment` for fresh test
|
|
30
|
-
records, explicit `reference` or `references` for manual fixtures, and
|
|
31
|
-
`syntheticReferences: true` only for isolated adapter/HTTP fixture tests.
|
|
32
|
-
|
|
33
|
-
The CLI runs configured scenarios sequentially. Delivery waves inside a
|
|
34
|
-
concurrency scenario remain concurrent. `--name` runs one exact test name and
|
|
35
|
-
`--json` emits machine-readable reports:
|
|
36
|
-
|
|
37
|
-
pnpm exec bachsproof test --name "underpaid payment"
|
|
38
|
-
pnpm exec bachsproof test --json
|
|
39
|
-
|
|
40
|
-
Add `requireFinancialVerification: true` when the suite must fail unless the
|
|
41
|
-
callback has observed committed financial state. Without a callback, BachsProof
|
|
42
|
-
can still test HTTP delivery, but it reports the run as financially unverified.
|
|
43
|
-
|
|
44
|
-
For optional controlled concurrency testing, configure a checkpoint and use
|
|
45
|
-
`@bachsproof/sdk` in an explicitly enabled test build. Ordinary black-box HTTP
|
|
46
|
-
concurrency is not deterministic race-condition coverage.
|
|
47
|
-
|
|
48
|
-
See the repository [quickstart](../../docs/quickstart.md) and
|
|
49
|
-
[CLI guide](../../docs/cli.md) for the complete workflow.
|
|
27
|
+
Financial verification is required. Configure a test-only application and
|
|
28
|
+
database; BachsProof never calls Bachs or moves real money.
|