Skip to content

Commit 81105fe

Browse files
committed
test(create): add two more org snap-tests from the RFC Testing Strategy
- `create-org-monorepo-direct-in-monorepo` — fixture is a minimal pnpm workspace with a manifest that has a single `monorepo: true` entry. `vp create @your-org/monorepo` directly targets that entry; verifies vp refuses with the same "Cannot create a monorepo inside an existing monorepo" message the built-in `vite:monorepo` flow produces. - `create-org-bundled-escape-check` — manifest entry has `template: "../outside"`. Verifies the schema-validation layer rejects the path before any tarball fetch happens. Error message names the offending field path. Snap-test coverage is now 6 of the 12 fixtures prescribed in the RFC Testing Strategy table. The remaining 6 are either (a) interactive picker tests needing PTY simulation — already covered by `org-picker.spec.ts` unit tests — or (b) tests that exercise the downstream-runner path (pnpm dlx a package the mock doesn't serve), which would require either further mock-registry work or `ignoreOutput: true` that thins the assertion.
1 parent b32ea45 commit 81105fe

8 files changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"@your-org/create": {
3+
"name": "@your-org/create",
4+
"dist-tags": { "latest": "1.0.0" },
5+
"versions": {
6+
"1.0.0": {
7+
"version": "1.0.0",
8+
"dist": {
9+
"tarball": "{REGISTRY}/@your-org/create/-/create-1.0.0.tgz",
10+
"integrity": "sha512-fake"
11+
},
12+
"vp": {
13+
"templates": [
14+
{
15+
"name": "escape",
16+
"description": "Relative path that escapes the package root",
17+
"template": "../outside"
18+
}
19+
]
20+
}
21+
}
22+
}
23+
}
24+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[1]> node $SNAP_CASES_DIR/.shared/mock-npm-registry.mjs -- vp create @your-org --no-interactive # `../outside` path rejected at schema-validation, before any tarball fetch
2+
3+
@your-org/create: vp.templates[0].template escapes the package root: ../outside
4+
Failed to resolve org template manifest
5+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"commands": [
3+
"node $SNAP_CASES_DIR/.shared/mock-npm-registry.mjs -- vp create @your-org --no-interactive # `../outside` path rejected at schema-validation, before any tarball fetch"
4+
]
5+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"@your-org/create": {
3+
"name": "@your-org/create",
4+
"dist-tags": { "latest": "1.0.0" },
5+
"versions": {
6+
"1.0.0": {
7+
"version": "1.0.0",
8+
"dist": {
9+
"tarball": "{REGISTRY}/@your-org/create/-/create-1.0.0.tgz",
10+
"integrity": "sha512-fake"
11+
},
12+
"vp": {
13+
"templates": [
14+
{
15+
"name": "monorepo",
16+
"description": "Monorepo scaffold",
17+
"template": "@your-org/template-monorepo",
18+
"monorepo": true
19+
}
20+
]
21+
}
22+
}
23+
}
24+
}
25+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "monorepo-direct-fixture",
3+
"private": true,
4+
"packageManager": "pnpm@10.0.0"
5+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packages:
2+
- packages/*
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[1]> node $SNAP_CASES_DIR/.shared/mock-npm-registry.mjs -- vp create @your-org/monorepo --no-interactive # direct-selecting a monorepo entry inside a monorepo -> refuse
2+
3+
You are already in a monorepo workspace.
4+
Use a different template or run this command outside the monorepo
5+
Cannot create a monorepo inside an existing monorepo
6+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"commands": [
3+
"node $SNAP_CASES_DIR/.shared/mock-npm-registry.mjs -- vp create @your-org/monorepo --no-interactive # direct-selecting a monorepo entry inside a monorepo -> refuse"
4+
]
5+
}

0 commit comments

Comments
 (0)