supatester-cli 1.0.7 → 1.0.9
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 +179 -1
- package/dist/bin/supatester.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,181 @@
|
|
|
1
1
|
# Supatester CLI
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Run Supabase test plans from the command line — the CI/CD companion for [Supatester](https://supatester.com).
|
|
4
|
+
|
|
5
|
+
Supatester CLI executes Supatester test plan export files against a live Supabase instance, producing CI-friendly output.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g supatester-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Export a test plan from the Supatester desktop app using "Export for CLI"
|
|
17
|
+
# Then run it:
|
|
18
|
+
supatester run ./my-tests.json --url https://your-project.supabase.co --publishable-key your-anon-key
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
cd cli
|
|
22
|
+
npm run build
|
|
23
|
+
node dist/bin/supatester.js run ./supatester-export-project.json --url https://nxwobgdsfgdsdwff.supabase.co --publishable-key "sb_publishable_KJhjshfosdjJHKjdisijdfnkd"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
supatester run <file> [options]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Connection Options
|
|
33
|
+
|
|
34
|
+
| Flag | Env Variable | Description |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| `--url <url>` | `SUPABASE_URL` | Supabase project URL |
|
|
37
|
+
| `--publishable-key <key>` | `SUPABASE_ANON_KEY` | Publishable (anon) key |
|
|
38
|
+
| `--secret-key <key>` | `SUPABASE_SERVICE_ROLE_KEY` | Service-role (secret) key |
|
|
39
|
+
| `--custom-jwt <token>` | `SUPABASE_CUSTOM_JWT` | Custom JWT for custom-jwt auth context |
|
|
40
|
+
| `--email <email>` | `SUPABASE_EMAIL` | Email for email auth context |
|
|
41
|
+
| `--password <password>` | `SUPABASE_PASSWORD` | Password for email auth context |
|
|
42
|
+
|
|
43
|
+
### Execution Options
|
|
44
|
+
|
|
45
|
+
| Flag | Default | Description |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| `--bail` | `false` | Stop on first test failure |
|
|
48
|
+
| `--no-bail` | — | Ignore `stopOnFailure` from test plans |
|
|
49
|
+
| `--test-plan <name>` | all | Run only the specified test plan (repeatable) |
|
|
50
|
+
| `--delay-request <ms>` | `0` | Delay between requests |
|
|
51
|
+
| `--timeout <ms>` | `0` | Overall timeout |
|
|
52
|
+
| `--timeout-request <ms>` | `30000` | Per-request timeout |
|
|
53
|
+
| `--var "name=value"` | — | Set a variable (repeatable) |
|
|
54
|
+
|
|
55
|
+
### Reporter Options
|
|
56
|
+
|
|
57
|
+
| Flag | Default | Description |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `-r, --reporters <list>` | `cli` | Comma-separated: `cli`, `json`, `junit`, `progress` |
|
|
60
|
+
| `--reporter-json-export <path>` | `./supatester/results.json` | JSON output path |
|
|
61
|
+
| `--reporter-junit-export <path>` | `./supatester/results.xml` | JUnit XML path |
|
|
62
|
+
|
|
63
|
+
### Output Options
|
|
64
|
+
|
|
65
|
+
| Flag | Default | Description |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| `--color <on\|off\|auto>` | `auto` | Coloured output |
|
|
68
|
+
| `--disable-unicode` | `false` | Plain text symbols |
|
|
69
|
+
| `-x, --suppress-exit-code` | `false` | Always exit 0 |
|
|
70
|
+
| `--verbose` | `false` | Show request/response data |
|
|
71
|
+
|
|
72
|
+
## Exit Codes
|
|
73
|
+
|
|
74
|
+
| Code | Meaning |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `0` | All tests passed |
|
|
77
|
+
| `1` | One or more tests failed |
|
|
78
|
+
| `2` | Run error (invalid file, connection failure, etc.) |
|
|
79
|
+
|
|
80
|
+
## Reporters
|
|
81
|
+
|
|
82
|
+
### CLI (default)
|
|
83
|
+
|
|
84
|
+
Pretty-printed terminal output:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
supatester
|
|
88
|
+
|
|
89
|
+
→ 1. Auth Context Verification
|
|
90
|
+
✓ RPC get_user_context as Anonymous (124ms)
|
|
91
|
+
✗ RPC get_user_context as Secret Key (112ms)
|
|
92
|
+
Error: Response does not contain "service_role"
|
|
93
|
+
|
|
94
|
+
┌─────────────────────────────────┬──────────┬──────────┐
|
|
95
|
+
│ │ executed │ failed │
|
|
96
|
+
├─────────────────────────────────┼──────────┼──────────┤
|
|
97
|
+
│ tests │ 5 │ 1 │
|
|
98
|
+
└─────────────────────────────────┴──────────┴──────────┘
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### JUnit XML
|
|
102
|
+
|
|
103
|
+
For CI systems (GitHub Actions, GitLab CI, Azure DevOps, Jenkins):
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
supatester run ./tests.json -r junit --reporter-junit-export ./results.xml
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### JSON
|
|
110
|
+
|
|
111
|
+
Full run summary as JSON:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
supatester run ./tests.json -r json --reporter-json-export ./results.json
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Multiple Reporters
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
supatester run ./tests.json -r cli,junit,json \
|
|
121
|
+
--reporter-junit-export ./reports/junit.xml \
|
|
122
|
+
--reporter-json-export ./reports/results.json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## CI/CD Examples
|
|
126
|
+
|
|
127
|
+
### GitHub Actions
|
|
128
|
+
|
|
129
|
+
```yaml
|
|
130
|
+
name: Supabase API Tests
|
|
131
|
+
on: [push, pull_request]
|
|
132
|
+
|
|
133
|
+
permissions:
|
|
134
|
+
contents: read
|
|
135
|
+
checks: write
|
|
136
|
+
|
|
137
|
+
jobs:
|
|
138
|
+
test:
|
|
139
|
+
runs-on: ubuntu-latest
|
|
140
|
+
steps:
|
|
141
|
+
- uses: actions/checkout@v4
|
|
142
|
+
- uses: actions/setup-node@v4
|
|
143
|
+
with:
|
|
144
|
+
node-version: '18'
|
|
145
|
+
- run: npm install -g supatester-cli
|
|
146
|
+
- run: |
|
|
147
|
+
supatester run ./tests/supabase-tests.json \
|
|
148
|
+
--url ${{ secrets.SUPABASE_URL }} \
|
|
149
|
+
--publishable-key ${{ secrets.SUPABASE_ANON_KEY }} \
|
|
150
|
+
-r cli,junit \
|
|
151
|
+
--reporter-junit-export ./reports/junit.xml
|
|
152
|
+
- uses: dorny/test-reporter@v1
|
|
153
|
+
if: always()
|
|
154
|
+
with:
|
|
155
|
+
name: Supabase Tests
|
|
156
|
+
path: ./reports/junit.xml
|
|
157
|
+
reporter: java-junit
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
## Programmatic API
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
import { run } from 'supatester-cli'
|
|
165
|
+
|
|
166
|
+
const { run: summary } = await run({
|
|
167
|
+
testPlan: require('./my-test-export.json'),
|
|
168
|
+
url: process.env.SUPABASE_URL!,
|
|
169
|
+
publishableKey: process.env.SUPABASE_ANON_KEY!,
|
|
170
|
+
reporters: ['cli', 'junit'],
|
|
171
|
+
reporter: {
|
|
172
|
+
junit: { export: './results/junit.xml' }
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
process.exit(summary.failures.length > 0 ? 1 : 0)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
See LICENSE file
|