@planningcenter/tapestry-migration-cli 4.10.0 → 4.10.1-qa-1450.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/index.test.ts +63 -50
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/tapestry-migration-cli",
3
- "version": "4.10.0",
3
+ "version": "4.10.1-qa-1450.0",
4
4
  "description": "CLI tool for Tapestry migrations",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,7 +31,7 @@
31
31
  "devDependencies": {
32
32
  "@emotion/react": "^11.14.0",
33
33
  "@planningcenter/tapestry-react": "^4.11.5",
34
- "@planningcenter/tapestry-tokens": "^4.4.0",
34
+ "@planningcenter/tapestry-tokens": "^4.10.1-qa-1450.0",
35
35
  "@types/jscodeshift": "^17.3.0",
36
36
  "@types/node": "^20.0.0",
37
37
  "typescript": "^5.8.3",
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "3457b28c41e489b5e2fce83c8afa2e67b8df54ed"
53
+ "gitHead": "c2f44c24a37c0284f83986a1fb540cb24bdbb425"
54
54
  }
package/src/index.test.ts CHANGED
@@ -13,67 +13,80 @@ import { describe, expect, it } from "vitest"
13
13
  import { buildMigrationList } from "./migrationList"
14
14
 
15
15
  const CLI_PATH = fileURLToPath(new URL("./index.ts", import.meta.url))
16
+ // tsx cold-start can take a few seconds; allow up to 30 s.
17
+ const CLI_TIMEOUT_MS = 30_000
16
18
 
17
19
  function runCli(args: string[]) {
18
20
  return spawnSync("npx", ["tsx", CLI_PATH, ...args], {
19
21
  encoding: "utf8",
20
- // tsx cold-start can take a few seconds; allow up to 30 s.
21
- timeout: 30_000,
22
+ timeout: CLI_TIMEOUT_MS,
22
23
  })
23
24
  }
24
25
 
25
- describe("list --json (stdout/exit-code contract)", () => {
26
- it("exits with code 0", () => {
27
- const result = runCli(["list", "--json"])
28
- expect(result.status).toBe(0)
29
- })
26
+ describe(
27
+ "list --json (stdout/exit-code contract)",
28
+ { timeout: CLI_TIMEOUT_MS },
29
+ () => {
30
+ it("exits with code 0", () => {
31
+ const result = runCli(["list", "--json"])
32
+ expect(result.status).toBe(0)
33
+ })
30
34
 
31
- it("emits valid JSON as the entire stdout (no stray lines)", () => {
32
- const result = runCli(["list", "--json"])
33
- // JSON.parse throws if there is ANY non-JSON content on stdout.
34
- expect(() => JSON.parse(result.stdout)).not.toThrow()
35
- })
35
+ it("emits valid JSON as the entire stdout (no stray lines)", () => {
36
+ const result = runCli(["list", "--json"])
37
+ // JSON.parse throws if there is ANY non-JSON content on stdout.
38
+ expect(() => JSON.parse(result.stdout)).not.toThrow()
39
+ })
36
40
 
37
- it("payload matches buildMigrationList() (schemaVersion + migrations)", () => {
38
- const result = runCli(["list", "--json"])
39
- const payload = JSON.parse(result.stdout)
40
- expect(payload).toEqual(buildMigrationList())
41
- })
41
+ it("payload matches buildMigrationList() (schemaVersion + migrations)", () => {
42
+ const result = runCli(["list", "--json"])
43
+ const payload = JSON.parse(result.stdout)
44
+ expect(payload).toEqual(buildMigrationList())
45
+ })
42
46
 
43
- it("schemaVersion is exactly the integer 1", () => {
44
- const result = runCli(["list", "--json"])
45
- const { schemaVersion } = JSON.parse(result.stdout)
46
- expect(schemaVersion).toBe(1)
47
- expect(Number.isInteger(schemaVersion)).toBe(true)
48
- })
47
+ it("schemaVersion is exactly the integer 1", () => {
48
+ const result = runCli(["list", "--json"])
49
+ const { schemaVersion } = JSON.parse(result.stdout)
50
+ expect(schemaVersion).toBe(1)
51
+ expect(Number.isInteger(schemaVersion)).toBe(true)
52
+ })
49
53
 
50
- it("stderr is empty on success", () => {
51
- const result = runCli(["list", "--json"])
52
- expect(result.stderr).toBe("")
53
- })
54
+ it("stderr is empty on success", () => {
55
+ const result = runCli(["list", "--json"])
56
+ expect(result.stderr).toBe("")
57
+ })
54
58
 
55
- it("does not require --path and makes no filesystem writes", () => {
56
- // If --path were required, commander would write an error to stderr and exit 1.
57
- // We assert the happy path — exit 0 with no --path — proving the flag is absent.
58
- const result = runCli(["list", "--json"])
59
- expect(result.status).toBe(0)
60
- })
61
- })
59
+ it("does not require --path and makes no filesystem writes", () => {
60
+ // If --path were required, commander would write an error to stderr and exit 1.
61
+ // We assert the happy path — exit 0 with no --path — proving the flag is absent.
62
+ const result = runCli(["list", "--json"])
63
+ expect(result.status).toBe(0)
64
+ })
65
+ }
66
+ )
62
67
 
63
- describe("list (human-readable, non-contractual)", () => {
64
- it("exits with code 0 and writes component ids to stdout", () => {
65
- const result = runCli(["list"])
66
- expect(result.status).toBe(0)
67
- expect(result.stdout).toContain("button")
68
- expect(result.stdout).toContain("toggle-switch")
69
- })
70
- })
68
+ describe(
69
+ "list (human-readable, non-contractual)",
70
+ { timeout: CLI_TIMEOUT_MS },
71
+ () => {
72
+ it("exits with code 0 and writes component ids to stdout", () => {
73
+ const result = runCli(["list"])
74
+ expect(result.status).toBe(0)
75
+ expect(result.stdout).toContain("button")
76
+ expect(result.stdout).toContain("toggle-switch")
77
+ })
78
+ }
79
+ )
71
80
 
72
- describe("diagnostics contract (nonzero exit → stderr)", () => {
73
- it("exits nonzero and writes to stderr for an unknown subcommand", () => {
74
- const result = runCli(["unknown-subcommand"])
75
- // Commander writes "error: unknown command 'unknown-subcommand'" to stderr.
76
- expect(result.status).not.toBe(0)
77
- expect(result.stderr.length).toBeGreaterThan(0)
78
- })
79
- })
81
+ describe(
82
+ "diagnostics contract (nonzero exit → stderr)",
83
+ { timeout: CLI_TIMEOUT_MS },
84
+ () => {
85
+ it("exits nonzero and writes to stderr for an unknown subcommand", () => {
86
+ const result = runCli(["unknown-subcommand"])
87
+ // Commander writes "error: unknown command 'unknown-subcommand'" to stderr.
88
+ expect(result.status).not.toBe(0)
89
+ expect(result.stderr.length).toBeGreaterThan(0)
90
+ })
91
+ }
92
+ )