Commit 7a6b58b
committed
refactor(create): address round-2 simplify review
Four small quality wins plus the big one — shared snap-test helper:
- `packages/tools/src/snap-test.ts`: expose `SNAP_CASES_DIR` as an env
var pointing at the source cases directory. Lets fixtures reference
shared helper scripts under `<casesDir>/.shared/` without duplicating
them into every fixture. The dot-prefix keeps the shared dir invisible
to the test iterator (which already skips dotfiles).
- Collapse the 4 byte-identical `mock-server.mjs` copies (89 LOC each)
into a single `packages/cli/snap-tests/.shared/mock-npm-registry.mjs`.
Each fixture's `steps.json` now invokes it via
`node $SNAP_CASES_DIR/.shared/mock-npm-registry.mjs -- vp create ...`.
Bug fixes to the mock registry now apply to all consumers at once.
- `org-picker.ts`: drop the hard-coded "inside a monorepo" message from
the empty-filter branch. Move the context-specific info note to the
caller (`org-resolve.ts`), gated on the exact predicate that produced
the empty filter. Keeps the picker context-agnostic so future filters
don't need to update picker internals.
- `templates/bundled.ts`: drop the "@org/create package" presumption
from the ENOENT error message. The executor is generic — it only
knows about `localPath` — so the message follows suit.
- `org-picker.spec.ts`: simplify the escape-hatch round-trip assertion
by dropping the externally-captured `escapeValue` variable. The
mockImplementation return value is sufficient on its own.
Snaps regenerated (only the command line in the first row changed to
reference the shared helper via $SNAP_CASES_DIR); output bodies
byte-identical; full unit suite still 263/263.
Net: -267 LOC across 17 files.1 parent ea02286 commit 7a6b58b
17 files changed
Lines changed: 32 additions & 299 deletions
File tree
- packages
- cli
- snap-tests
- create-org-bundled
- create-org-invalid-manifest
- create-org-monorepo-filter
- create-org-no-interactive-error
- src/create
- __tests__
- templates
- tools/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
Lines changed: 0 additions & 89 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
Lines changed: 0 additions & 89 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
Lines changed: 0 additions & 89 deletions
This file was deleted.
0 commit comments