@minniexcode/codex-switch 0.0.11 → 0.1.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.
@@ -1,151 +1,31 @@
1
- # Testing Guide
2
-
3
- `codex-switch` currently ships with five active test layers:
4
-
5
- - `tests/commands.spec.js`: argument parsing, help rendering, and command dispatch contracts
6
- - `tests/cli-e2e.spec.js`: built CLI entrypoint checks for user-visible command behavior and rendered output
7
- - `tests/interaction.spec.js`: prompt boundary and interactive data collection behavior
8
- - `tests/runtime.spec.js`: Codex runtime probing and version checks
9
- - `tests/workflows.spec.js`: file-backed app workflow coverage for write operations and rollback paths
10
-
11
- ## Commands
12
-
13
- Build the CLI:
14
-
15
- ```bash
16
- npm run build
17
- ```
18
-
19
- Run the full suite:
20
-
21
- ```bash
22
- npm test
23
- ```
24
-
25
- `npm test` is not compile-only. It runs:
26
-
27
- ```bash
28
- npm run build
29
- node tests/run-tests.js
30
- ```
31
-
32
- Run one suite manually:
33
-
34
- ```bash
35
- node -e "require('./tests/cli-e2e.spec').tests[0].run()"
36
- node -e "require('./tests/workflows.spec').tests[0].run()"
37
- ```
38
-
39
- ## Development Fixture
40
-
41
- The repository fixture lives at:
42
-
43
- ```text
44
- dev-codex/local-sandbox/
45
- ```
46
-
47
- It is used in two different ways:
48
-
49
- - read-oriented CLI subprocess tests point at it directly
50
- - write-oriented tests copy it into a temporary directory before running mutations
51
-
52
- Do not point destructive automation directly at `dev-codex/local-sandbox` unless you intentionally want to update the fixture.
53
-
54
- ## Built CLI Coverage
55
-
56
- `tests/cli-e2e.spec.js` executes the built CLI entrypoint logic from `dist/` and asserts the same JSON and human-readable payloads users see.
57
-
58
- Covered entrypoint checks:
59
-
60
- - `--help`
61
- - `--version`
62
-
63
- Covered read commands against the repository sandbox:
64
-
65
- - `list --json`
66
- - `show --json`
67
- - `current --json`
68
- - `status --json`
69
- - `config show --json`
70
- - `config list-profiles --json`
71
- - `backups list --json`
72
- - `doctor --json`
73
-
74
- Covered write commands against temporary sandbox copies:
75
-
76
- - `init --json`
77
- - `add --json`
78
- - `add --create-profile --json`
79
- - `edit --json`
80
- - `switch --json`
81
- - `remove --force --json`
82
- - `import --json`
83
- - `export --force --json`
84
- - `rollback --json`
85
- - `setup --json`
86
-
87
- Covered non-interactive failure contracts:
88
-
89
- - `add` without an existing profile or `--create-profile`
90
- - blocking destructive removal of the active provider profile
91
- - `rollback <missing-id>`
92
- - `migrate --overwrite --json`
93
- - `setup --json`
94
-
95
- This harness intentionally avoids `child_process` subprocess spawning because the current Windows sandbox used by automation blocks nested process launches with `EPERM`. The suite still validates the built CLI layer rather than calling app functions directly.
96
-
97
- ## Workflow Coverage
98
-
99
- `tests/workflows.spec.js` keeps the deeper file-backed mutation coverage at the app/dispatch layer.
100
-
101
- Important workflow scenarios already covered there include:
102
-
103
- - non-interactive `init`
104
- - non-interactive `migrate` failure behavior
105
- - interactive `migrate` adoption via injected runtime
106
- - `add`, `edit`, `remove`
107
- - `switch` plus rollback
108
- - `export` and `import`
109
- - auth write rollback on failure
110
-
111
- ## Fixture Rules
112
-
113
- - Prefer `--codex-dir <temp-copy>` for all write tests.
114
- - Prefer `--json` when assertions need stable output.
115
- - Treat `show --json` output as sensitive because it includes unmasked API keys.
116
- - If a test needs `codex login` or `codex --version`, prefer mocking the spawn layer instead of assuming an installed local binary.
117
- - Keep fixture assertions focused on stable data such as provider names, active profile, backup count, and typed error codes.
118
-
119
- ## Reporting Template
120
-
121
- Use this template for release checks:
122
-
123
- ```text
124
- Version under test: 0.0.x
125
- Build: PASS/FAIL
126
- Suite results:
127
- - commands: PASS/FAIL
128
- - cli-e2e: PASS/FAIL
129
- - interaction: PASS/FAIL
130
- - runtime: PASS/FAIL
131
- - workflows: PASS/FAIL
132
-
133
- Read command checks:
134
- - help/version/list/show/current/status/config/backups/doctor
135
-
136
- Mutation checks:
137
- - init/add/edit/switch/remove/import/export/rollback/migrate/setup
138
-
139
- Open risks:
140
- - <risk 1>
141
- - <risk 2>
142
- ```
143
-
144
- ## Current Gaps
145
-
146
- Known areas that still deserve more coverage:
147
-
148
- - true subprocess automation for interactive TTY-only flows such as prompt-driven `migrate`
149
- - explicit tests for `rollback-latest`
150
- - more backup corruption cases inside historical manifests
151
- - docs and report snapshots should stay in sync with the current package version
1
+ # codex-switch Testing Guide
2
+
3
+ This guide records the release gate for `0.1.0`.
4
+
5
+ ## Required checks
6
+
7
+ Run these commands before publishing or reviewing release changes:
8
+
9
+ ```bash
10
+ npm run build
11
+ npm test
12
+ npx tsc --noEmit
13
+ npm pack --dry-run
14
+ node dist/cli.js --help
15
+ node dist/cli.js --version
16
+ ```
17
+
18
+ ## Release scenarios
19
+
20
+ - Fresh direct-provider flow: `init -> add -> switch -> status -> doctor`
21
+ - Fresh Copilot flow: `init -> login copilot -> add --copilot -> switch -> status -> doctor`
22
+ - Ambiguous active profile: `list`, `status`, and provider pickers must surface ambiguity instead of inventing a unique current provider
23
+ - `--json` envelope: top-level `ok`, `command`, `data`, `warnings`, and `error` must remain stable
24
+ - `migrate`: advanced adopt helper only
25
+ - `setup`: deprecated entry only
26
+
27
+ ## Fixture guidance
28
+
29
+ - Prefer isolated temp directories for mutating tests.
30
+ - Keep fixtures small and realistic.
31
+ - Use `dev-codex/local-sandbox` only when a test needs a representative Codex directory layout.