@supatype/cli 0.1.0-alpha.9 → 0.1.1
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/.turbo/turbo-build.log +2 -2
- package/.turbo/turbo-test.log +285 -69
- package/.turbo/turbo-typecheck.log +1 -1
- package/assets/supatype-logo-wordmark.ascii.txt +6 -0
- package/bin/dev-entry.ts +2 -1
- package/dist/app/framework.js +1 -3
- package/dist/app/framework.js.map +1 -1
- package/dist/app/proxy-dev-app.d.ts +14 -0
- package/dist/app/proxy-dev-app.d.ts.map +1 -1
- package/dist/app/proxy-dev-app.js +110 -6
- package/dist/app/proxy-dev-app.js.map +1 -1
- package/dist/app-config.d.ts +10 -0
- package/dist/app-config.d.ts.map +1 -1
- package/dist/app-config.js +72 -0
- package/dist/app-config.js.map +1 -1
- package/dist/assets/supatype-logo-wordmark.ascii.txt +6 -0
- package/dist/binary-cache.d.ts +19 -7
- package/dist/binary-cache.d.ts.map +1 -1
- package/dist/binary-cache.js +92 -46
- package/dist/binary-cache.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +17 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/add.d.ts +3 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +86 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/admin.d.ts +28 -1
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/admin.js +297 -149
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/adopt.d.ts +3 -0
- package/dist/commands/adopt.d.ts.map +1 -0
- package/dist/commands/adopt.js +55 -0
- package/dist/commands/adopt.js.map +1 -0
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/app.js +20 -17
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/cache.d.ts.map +1 -1
- package/dist/commands/cache.js +11 -10
- package/dist/commands/cache.js.map +1 -1
- package/dist/commands/cloud.d.ts +4 -9
- package/dist/commands/cloud.d.ts.map +1 -1
- package/dist/commands/cloud.js +75 -125
- package/dist/commands/cloud.js.map +1 -1
- package/dist/commands/db.d.ts.map +1 -1
- package/dist/commands/db.js +37 -58
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +140 -96
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +74 -39
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +39 -39
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +78 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +5 -4
- package/dist/commands/engine.js.map +1 -1
- package/dist/commands/functions.d.ts.map +1 -1
- package/dist/commands/functions.js +172 -119
- package/dist/commands/functions.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +5 -4
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.d.ts +35 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +883 -107
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/introspect.d.ts +3 -0
- package/dist/commands/introspect.d.ts.map +1 -0
- package/dist/commands/introspect.js +35 -0
- package/dist/commands/introspect.js.map +1 -0
- package/dist/commands/keys.d.ts +15 -1
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +46 -10
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/link-helpers.d.ts +15 -0
- package/dist/commands/link-helpers.d.ts.map +1 -0
- package/dist/commands/link-helpers.js +225 -0
- package/dist/commands/link-helpers.js.map +1 -0
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +5 -4
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/migrate-from-v1.d.ts.map +1 -1
- package/dist/commands/migrate-from-v1.js +3 -2
- package/dist/commands/migrate-from-v1.js.map +1 -1
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +119 -26
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/pg.d.ts.map +1 -1
- package/dist/commands/pg.js +11 -12
- package/dist/commands/pg.js.map +1 -1
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +55 -46
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/pull.d.ts.map +1 -1
- package/dist/commands/pull.js +33 -5
- package/dist/commands/pull.js.map +1 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +111 -138
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/seed.d.ts.map +1 -1
- package/dist/commands/seed.js +4 -3
- package/dist/commands/seed.js.map +1 -1
- package/dist/commands/self-host.d.ts +2 -2
- package/dist/commands/self-host.d.ts.map +1 -1
- package/dist/commands/self-host.js +65 -50
- package/dist/commands/self-host.js.map +1 -1
- package/dist/commands/self-update.d.ts.map +1 -1
- package/dist/commands/self-update.js +3 -2
- package/dist/commands/self-update.js.map +1 -1
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +95 -29
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js +3 -2
- package/dist/commands/types.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +54 -21
- package/dist/commands/update.js.map +1 -1
- package/dist/compose-rename.d.ts +10 -0
- package/dist/compose-rename.d.ts.map +1 -0
- package/dist/compose-rename.js +67 -0
- package/dist/compose-rename.js.map +1 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/dev-compose.d.ts +26 -0
- package/dist/dev-compose.d.ts.map +1 -1
- package/dist/dev-compose.js +357 -79
- package/dist/dev-compose.js.map +1 -1
- package/dist/dev-log-bus.d.ts +30 -0
- package/dist/dev-log-bus.d.ts.map +1 -0
- package/dist/dev-log-bus.js +87 -0
- package/dist/dev-log-bus.js.map +1 -0
- package/dist/dev-log-filter.d.ts +10 -0
- package/dist/dev-log-filter.d.ts.map +1 -0
- package/dist/dev-log-filter.js +36 -0
- package/dist/dev-log-filter.js.map +1 -0
- package/dist/dev-logo.d.ts +12 -0
- package/dist/dev-logo.d.ts.map +1 -0
- package/dist/dev-logo.js +56 -0
- package/dist/dev-logo.js.map +1 -0
- package/dist/dev-ports.d.ts +27 -0
- package/dist/dev-ports.d.ts.map +1 -0
- package/dist/dev-ports.js +171 -0
- package/dist/dev-ports.js.map +1 -0
- package/dist/dev-session-lock.d.ts +25 -0
- package/dist/dev-session-lock.d.ts.map +1 -0
- package/dist/dev-session-lock.js +81 -0
- package/dist/dev-session-lock.js.map +1 -0
- package/dist/dev-session.d.ts +26 -0
- package/dist/dev-session.d.ts.map +1 -0
- package/dist/dev-session.js +106 -0
- package/dist/dev-session.js.map +1 -0
- package/dist/dev-shutdown.d.ts +25 -0
- package/dist/dev-shutdown.d.ts.map +1 -0
- package/dist/dev-shutdown.js +114 -0
- package/dist/dev-shutdown.js.map +1 -0
- package/dist/dev-task-colors.d.ts +13 -0
- package/dist/dev-task-colors.d.ts.map +1 -0
- package/dist/dev-task-colors.js +43 -0
- package/dist/dev-task-colors.js.map +1 -0
- package/dist/dev-tui.d.ts +24 -0
- package/dist/dev-tui.d.ts.map +1 -0
- package/dist/dev-tui.js +188 -0
- package/dist/dev-tui.js.map +1 -0
- package/dist/diff-output.d.ts +5 -1
- package/dist/diff-output.d.ts.map +1 -1
- package/dist/diff-output.js +69 -0
- package/dist/diff-output.js.map +1 -1
- package/dist/docker-runtime.d.ts +30 -0
- package/dist/docker-runtime.d.ts.map +1 -0
- package/dist/docker-runtime.js +118 -0
- package/dist/docker-runtime.js.map +1 -0
- package/dist/engine-client.d.ts +10 -1
- package/dist/engine-client.d.ts.map +1 -1
- package/dist/engine-client.js +76 -17
- package/dist/engine-client.js.map +1 -1
- package/dist/engine-push-output.d.ts +17 -0
- package/dist/engine-push-output.d.ts.map +1 -0
- package/dist/engine-push-output.js +64 -0
- package/dist/engine-push-output.js.map +1 -0
- package/dist/ensure-binary.js +2 -2
- package/dist/ensure-binary.js.map +1 -1
- package/dist/env-file.d.ts +5 -0
- package/dist/env-file.d.ts.map +1 -0
- package/dist/env-file.js +33 -0
- package/dist/env-file.js.map +1 -0
- package/dist/gitignore.d.ts +8 -0
- package/dist/gitignore.d.ts.map +1 -0
- package/dist/gitignore.js +41 -0
- package/dist/gitignore.js.map +1 -0
- package/dist/kong-config.d.ts +9 -0
- package/dist/kong-config.d.ts.map +1 -1
- package/dist/kong-config.js +18 -1
- package/dist/kong-config.js.map +1 -1
- package/dist/link.d.ts +66 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +160 -0
- package/dist/link.js.map +1 -0
- package/dist/process-manager.d.ts +8 -0
- package/dist/process-manager.d.ts.map +1 -1
- package/dist/process-manager.js +53 -9
- package/dist/process-manager.js.map +1 -1
- package/dist/project-config.d.ts +30 -3
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +37 -4
- package/dist/project-config.js.map +1 -1
- package/dist/prompts.d.ts +3 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +3 -0
- package/dist/prompts.js.map +1 -0
- package/dist/pull-utils.d.ts +50 -14
- package/dist/pull-utils.d.ts.map +1 -1
- package/dist/pull-utils.js +152 -12
- package/dist/pull-utils.js.map +1 -1
- package/dist/resolve-target.d.ts +86 -0
- package/dist/resolve-target.d.ts.map +1 -0
- package/dist/resolve-target.js +291 -0
- package/dist/resolve-target.js.map +1 -0
- package/dist/restore-system-relation-targets.d.ts +3 -0
- package/dist/restore-system-relation-targets.d.ts.map +1 -0
- package/dist/restore-system-relation-targets.js +45 -0
- package/dist/restore-system-relation-targets.js.map +1 -0
- package/dist/runtime-routes.d.ts.map +1 -1
- package/dist/runtime-routes.js +7 -0
- package/dist/runtime-routes.js.map +1 -1
- package/dist/schema-ast-v2.d.ts +1 -1
- package/dist/schema-ast-v2.d.ts.map +1 -1
- package/dist/schema-ast-v2.js +2 -2
- package/dist/schema-ast-v2.js.map +1 -1
- package/dist/schema-sources.d.ts +40 -0
- package/dist/schema-sources.d.ts.map +1 -0
- package/dist/schema-sources.js +183 -0
- package/dist/schema-sources.js.map +1 -0
- package/dist/scripts/postinstall.js +5 -1
- package/dist/scripts/postinstall.js.map +1 -1
- package/dist/self-host-compose.d.ts +37 -1
- package/dist/self-host-compose.d.ts.map +1 -1
- package/dist/self-host-compose.js +234 -43
- package/dist/self-host-compose.js.map +1 -1
- package/dist/storage-provision.d.ts +4 -0
- package/dist/storage-provision.d.ts.map +1 -1
- package/dist/storage-provision.js +24 -2
- package/dist/storage-provision.js.map +1 -1
- package/dist/supatype-eval-1781522769253.d.mts +2 -0
- package/dist/supatype-eval-1781522769253.d.mts.map +1 -0
- package/dist/supatype-eval-1781522769253.mjs +3 -0
- package/dist/supatype-eval-1781522769253.mjs.map +1 -0
- package/dist/systemd.js +2 -2
- package/dist/systemd.js.map +1 -1
- package/dist/target-client.d.ts +10 -0
- package/dist/target-client.d.ts.map +1 -0
- package/dist/target-client.js +22 -0
- package/dist/target-client.js.map +1 -0
- package/dist/type-extractor.d.ts +11 -0
- package/dist/type-extractor.d.ts.map +1 -1
- package/dist/type-extractor.js +95 -8
- package/dist/type-extractor.js.map +1 -1
- package/dist/ui/brand.d.ts +9 -0
- package/dist/ui/brand.d.ts.map +1 -0
- package/dist/ui/brand.js +11 -0
- package/dist/ui/brand.js.map +1 -0
- package/dist/ui/confirm.d.ts +12 -0
- package/dist/ui/confirm.d.ts.map +1 -0
- package/dist/ui/confirm.js +28 -0
- package/dist/ui/confirm.js.map +1 -0
- package/dist/ui/fatal.d.ts +10 -0
- package/dist/ui/fatal.d.ts.map +1 -0
- package/dist/ui/fatal.js +34 -0
- package/dist/ui/fatal.js.map +1 -0
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +9 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/interactive.d.ts +3 -0
- package/dist/ui/interactive.d.ts.map +1 -0
- package/dist/ui/interactive.js +5 -0
- package/dist/ui/interactive.js.map +1 -0
- package/dist/ui/messages.d.ts +10 -0
- package/dist/ui/messages.d.ts.map +1 -0
- package/dist/ui/messages.js +35 -0
- package/dist/ui/messages.js.map +1 -0
- package/dist/ui/next-steps.d.ts +3 -0
- package/dist/ui/next-steps.d.ts.map +1 -0
- package/dist/ui/next-steps.js +10 -0
- package/dist/ui/next-steps.js.map +1 -0
- package/dist/ui/progress.d.ts +5 -0
- package/dist/ui/progress.d.ts.map +1 -0
- package/dist/ui/progress.js +24 -0
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/prompts.d.ts +14 -0
- package/dist/ui/prompts.d.ts.map +1 -0
- package/dist/ui/prompts.js +34 -0
- package/dist/ui/prompts.js.map +1 -0
- package/package.json +5 -2
- package/src/app/framework.ts +1 -3
- package/src/app/proxy-dev-app.ts +114 -6
- package/src/app-config.ts +80 -0
- package/src/binary-cache.ts +102 -52
- package/src/cli.ts +16 -2
- package/src/commands/add.ts +97 -0
- package/src/commands/admin.ts +381 -190
- package/src/commands/adopt.ts +82 -0
- package/src/commands/app.ts +20 -17
- package/src/commands/cache.ts +11 -10
- package/src/commands/cloud.ts +91 -142
- package/src/commands/db.ts +40 -63
- package/src/commands/deploy.ts +186 -126
- package/src/commands/dev.ts +98 -55
- package/src/commands/diff.ts +52 -43
- package/src/commands/doctor.ts +103 -0
- package/src/commands/engine.ts +5 -4
- package/src/commands/functions.ts +187 -123
- package/src/commands/generate.ts +5 -4
- package/src/commands/init.ts +1087 -104
- package/src/commands/introspect.ts +48 -0
- package/src/commands/keys.ts +56 -14
- package/src/commands/link-helpers.ts +273 -0
- package/src/commands/logs.ts +5 -4
- package/src/commands/migrate-from-v1.ts +3 -2
- package/src/commands/migrate.ts +167 -27
- package/src/commands/pg.ts +13 -18
- package/src/commands/plugins.ts +55 -46
- package/src/commands/pull.ts +38 -9
- package/src/commands/push.ts +148 -175
- package/src/commands/seed.ts +5 -4
- package/src/commands/self-host.ts +85 -54
- package/src/commands/self-update.ts +3 -2
- package/src/commands/status.ts +102 -33
- package/src/commands/types.ts +3 -2
- package/src/commands/update.ts +59 -23
- package/src/compose-rename.ts +76 -0
- package/src/config.ts +2 -1
- package/src/dev-compose.ts +462 -76
- package/src/dev-log-bus.ts +101 -0
- package/src/dev-log-filter.ts +32 -0
- package/src/dev-logo.ts +61 -0
- package/src/dev-ports.ts +212 -0
- package/src/dev-session-lock.ts +101 -0
- package/src/dev-session.ts +130 -0
- package/src/dev-shutdown.ts +147 -0
- package/src/dev-task-colors.ts +47 -0
- package/src/dev-tui.ts +232 -0
- package/src/diff-output.ts +79 -1
- package/src/docker-runtime.ts +151 -0
- package/src/engine-client.ts +81 -17
- package/src/engine-push-output.ts +75 -0
- package/src/ensure-binary.ts +2 -2
- package/src/env-file.ts +37 -0
- package/src/gitignore.ts +48 -0
- package/src/kong-config.ts +24 -1
- package/src/link.ts +243 -0
- package/src/process-manager.ts +66 -10
- package/src/project-config.ts +62 -7
- package/src/prompts.ts +2 -0
- package/src/pull-utils.ts +217 -23
- package/src/resolve-target.ts +419 -0
- package/src/restore-system-relation-targets.ts +45 -0
- package/src/runtime-routes.ts +7 -0
- package/src/schema-ast-v2.ts +2 -1
- package/src/schema-sources.ts +248 -0
- package/src/scripts/postinstall.ts +7 -1
- package/src/self-host-compose.ts +262 -46
- package/src/storage-provision.ts +33 -1
- package/src/supatype-eval-1781522769253.mts +1 -0
- package/src/systemd.ts +2 -2
- package/src/target-client.ts +40 -0
- package/src/type-extractor.ts +124 -11
- package/src/ui/README.md +17 -0
- package/src/ui/brand.ts +12 -0
- package/src/ui/confirm.ts +38 -0
- package/src/ui/fatal.ts +43 -0
- package/src/ui/index.ts +8 -0
- package/src/ui/interactive.ts +4 -0
- package/src/ui/messages.ts +43 -0
- package/src/ui/next-steps.ts +10 -0
- package/src/ui/progress.ts +28 -0
- package/src/ui/prompts.ts +40 -0
- package/tests/admin-ensure.test.ts +59 -0
- package/tests/cli-help.test.ts +27 -2
- package/tests/config.test.ts +29 -2
- package/tests/dev-ports.test.ts +41 -0
- package/tests/dev-session-lock.test.ts +54 -0
- package/tests/dev-ui.test.ts +162 -0
- package/tests/docker-runtime.test.ts +236 -0
- package/tests/engine-push-output.test.ts +67 -0
- package/tests/init.test.ts +197 -18
- package/tests/link.test.ts +148 -0
- package/tests/minisign.test.ts +102 -0
- package/tests/proxy-dev-app.test.ts +45 -1
- package/tests/pull-utils.test.ts +5 -4
- package/tests/runtime-contract.test.ts +186 -2
- package/tests/schema-sources.test.ts +119 -0
- package/tests/storage-provision.test.ts +100 -0
- package/tests/ui-confirm.test.ts +41 -0
- package/tests/ui-messages.test.ts +66 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest"
|
|
2
|
+
import { mkdtempSync, writeFileSync, existsSync, mkdirSync } from "node:fs"
|
|
3
|
+
import { join } from "node:path"
|
|
4
|
+
import { tmpdir } from "node:os"
|
|
5
|
+
import {
|
|
6
|
+
clearDevSessionLock,
|
|
7
|
+
devSessionLockPath,
|
|
8
|
+
readDevSessionLock,
|
|
9
|
+
writeDevSessionLock,
|
|
10
|
+
} from "../src/dev-session-lock.js"
|
|
11
|
+
|
|
12
|
+
describe("dev-session-lock", () => {
|
|
13
|
+
let dir: string
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
dir = mkdtempSync(join(tmpdir(), "supatype-lock-"))
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
clearDevSessionLock(dir)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it("writes and reads a lock file", () => {
|
|
24
|
+
writeDevSessionLock(dir, {
|
|
25
|
+
composeProject: "supatype-demo",
|
|
26
|
+
projectRef: "demo",
|
|
27
|
+
composePath: join(dir, ".supatype/self-host/docker-compose.yml"),
|
|
28
|
+
kongPort: 18473,
|
|
29
|
+
startedAt: "2026-01-01T00:00:00.000Z",
|
|
30
|
+
})
|
|
31
|
+
expect(existsSync(devSessionLockPath(dir))).toBe(true)
|
|
32
|
+
const lock = readDevSessionLock(dir)
|
|
33
|
+
expect(lock?.composeProject).toBe("supatype-demo")
|
|
34
|
+
expect(lock?.kongPort).toBe(18473)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it("clears the lock file", () => {
|
|
38
|
+
mkdirSync(join(dir, ".supatype"), { recursive: true })
|
|
39
|
+
writeFileSync(
|
|
40
|
+
devSessionLockPath(dir),
|
|
41
|
+
JSON.stringify({
|
|
42
|
+
version: 1,
|
|
43
|
+
composeProject: "supatype-demo",
|
|
44
|
+
projectRef: "demo",
|
|
45
|
+
composePath: "x",
|
|
46
|
+
kongPort: 1,
|
|
47
|
+
startedAt: "t",
|
|
48
|
+
}),
|
|
49
|
+
"utf8",
|
|
50
|
+
)
|
|
51
|
+
clearDevSessionLock(dir)
|
|
52
|
+
expect(existsSync(devSessionLockPath(dir))).toBe(false)
|
|
53
|
+
})
|
|
54
|
+
})
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest"
|
|
2
|
+
import { mkdtempSync, writeFileSync } from "node:fs"
|
|
3
|
+
import { join } from "node:path"
|
|
4
|
+
import { tmpdir } from "node:os"
|
|
5
|
+
import { DevLogBus } from "../src/dev-log-bus.js"
|
|
6
|
+
import { filterDevSubprocessLine, formatConsoleArgs, stripAnsi } from "../src/dev-log-filter.js"
|
|
7
|
+
import { appendDevTaskLog, beginDevSession, endDevSession, resolveDevUiMode } from "../src/dev-session.js"
|
|
8
|
+
import {
|
|
9
|
+
layoutLogoBlock,
|
|
10
|
+
logoRowCount,
|
|
11
|
+
pickLogoLines,
|
|
12
|
+
SUPATYPE_ASCII_LOGO_WORDMARK,
|
|
13
|
+
} from "../src/dev-logo.js"
|
|
14
|
+
import { normalizeStackLogLine, taskColor } from "../src/dev-task-colors.js"
|
|
15
|
+
|
|
16
|
+
describe("filterDevSubprocessLine()", () => {
|
|
17
|
+
it("filters npm script banners and vite network URLs for app", () => {
|
|
18
|
+
expect(filterDevSubprocessLine("app", "> vite")).toBe(false)
|
|
19
|
+
expect(filterDevSubprocessLine("app", " ➜ Network: http://10.0.0.1:5173/")).toBe(false)
|
|
20
|
+
expect(filterDevSubprocessLine("app", " ➜ Local: http://localhost:5173/")).toBe(true)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it("does not filter stack logs", () => {
|
|
24
|
+
expect(filterDevSubprocessLine("stack", "> vite")).toBe(true)
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
describe("stripAnsi()", () => {
|
|
29
|
+
it("removes colour codes", () => {
|
|
30
|
+
expect(stripAnsi("\x1b[33mhello\x1b[0m")).toBe("hello")
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe("formatConsoleArgs()", () => {
|
|
35
|
+
it("joins mixed arguments", () => {
|
|
36
|
+
expect(formatConsoleArgs(["a", 1])).toBe("a 1")
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
describe("DevLogBus", () => {
|
|
41
|
+
it("marks non-focused tasks unread", () => {
|
|
42
|
+
const bus = new DevLogBus()
|
|
43
|
+
bus.registerTask("app", "app")
|
|
44
|
+
bus.setFocusedTaskId("stack")
|
|
45
|
+
bus.append("app", "ready")
|
|
46
|
+
expect(bus.getTask("app")?.unread).toBe(true)
|
|
47
|
+
bus.setFocusedTaskId("app")
|
|
48
|
+
expect(bus.getTask("app")?.unread).toBe(false)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it("splits multiline append into separate rows", () => {
|
|
52
|
+
const bus = new DevLogBus()
|
|
53
|
+
bus.append("stack", "line one\nline two")
|
|
54
|
+
expect(bus.getTask("stack")?.lines).toEqual(["line one", "line two"])
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it("strips [supatype] prefix on stack task", () => {
|
|
58
|
+
const bus = new DevLogBus()
|
|
59
|
+
bus.append("stack", "[supatype] hello")
|
|
60
|
+
expect(bus.getTask("stack")?.lines).toEqual(["hello"])
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
describe("resolveDevUiMode()", () => {
|
|
65
|
+
it("honours --stream", () => {
|
|
66
|
+
expect(resolveDevUiMode(true)).toBe("stream")
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
describe("appendDevTaskLog()", () => {
|
|
71
|
+
afterEach(() => {
|
|
72
|
+
endDevSession()
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it("routes proxy bootstrap lines to the app task in TUI mode", () => {
|
|
76
|
+
const session = beginDevSession("tui")
|
|
77
|
+
appendDevTaskLog("app", "app", "Proxy mode: running npm run vite (/tmp/app)")
|
|
78
|
+
expect(session.bus.getTask("app")?.lines).toEqual(["Proxy mode: running npm run vite (/tmp/app)"])
|
|
79
|
+
expect(session.bus.getTask("stack")?.lines ?? []).toEqual([])
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
describe("dev-logo", () => {
|
|
84
|
+
it("preserves authored line spacing including trailing spaces", () => {
|
|
85
|
+
const out = layoutLogoBlock([" aa", " bbbb ", ""])
|
|
86
|
+
expect(out[0]).toBe(" aa")
|
|
87
|
+
expect(out[1]).toBe(" bbbb ")
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
it("loads the figlet slant wordmark", () => {
|
|
91
|
+
expect(pickLogoLines()).toEqual([...SUPATYPE_ASCII_LOGO_WORDMARK])
|
|
92
|
+
expect(logoRowCount()).toBe(6)
|
|
93
|
+
expect(SUPATYPE_ASCII_LOGO_WORDMARK[1]).toContain("_______")
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
describe("dev-task-colors", () => {
|
|
98
|
+
it("assigns purple to stack and green to app", () => {
|
|
99
|
+
expect(taskColor("stack")).toBe("\x1b[35m")
|
|
100
|
+
expect(taskColor("app")).toBe("\x1b[32m")
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
it("strips stack log prefix", () => {
|
|
104
|
+
expect(normalizeStackLogLine("[supatype] Waiting for Postgres")).toBe("Waiting for Postgres")
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
describe("dev-shutdown", () => {
|
|
109
|
+
const exitSpy = vi.spyOn(process, "exit").mockImplementation((() => undefined) as typeof process.exit)
|
|
110
|
+
const stderrSpy = vi.spyOn(process.stderr, "write").mockImplementation(() => true)
|
|
111
|
+
|
|
112
|
+
beforeEach(() => {
|
|
113
|
+
exitSpy.mockClear()
|
|
114
|
+
stderrSpy.mockClear()
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
afterEach(() => {
|
|
118
|
+
vi.resetModules()
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
it("exits 0 after registered work completes", async () => {
|
|
122
|
+
vi.resetModules()
|
|
123
|
+
const { registerDevShutdown, requestDevShutdown } = await import("../src/dev-shutdown.js")
|
|
124
|
+
let ran = false
|
|
125
|
+
registerDevShutdown(async () => {
|
|
126
|
+
ran = true
|
|
127
|
+
})
|
|
128
|
+
requestDevShutdown()
|
|
129
|
+
await vi.waitFor(() => expect(exitSpy).toHaveBeenCalledWith(0))
|
|
130
|
+
expect(ran).toBe(true)
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
it("warns on second interrupt then force-exits on third", async () => {
|
|
134
|
+
vi.resetModules()
|
|
135
|
+
const { registerDevShutdown, requestDevShutdown } = await import("../src/dev-shutdown.js")
|
|
136
|
+
registerDevShutdown(async () => {
|
|
137
|
+
await new Promise(() => undefined)
|
|
138
|
+
})
|
|
139
|
+
requestDevShutdown()
|
|
140
|
+
await vi.waitFor(() => expect(exitSpy).toHaveBeenCalledTimes(0))
|
|
141
|
+
requestDevShutdown()
|
|
142
|
+
expect(stderrSpy).toHaveBeenCalled()
|
|
143
|
+
expect(exitSpy).toHaveBeenCalledTimes(0)
|
|
144
|
+
requestDevShutdown()
|
|
145
|
+
expect(exitSpy).toHaveBeenCalledWith(130)
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
it("registers compose fallback for sync exit cleanup", async () => {
|
|
149
|
+
vi.resetModules()
|
|
150
|
+
const { registerDevShutdown, hasComposeShutdownFallback, resetDevShutdownForTests } =
|
|
151
|
+
await import("../src/dev-shutdown.js")
|
|
152
|
+
resetDevShutdownForTests()
|
|
153
|
+
const dir = mkdtempSync(join(tmpdir(), "supatype-shutdown-"))
|
|
154
|
+
const composePath = join(dir, "docker-compose.yml")
|
|
155
|
+
writeFileSync(composePath, "services: {}\n", "utf8")
|
|
156
|
+
registerDevShutdown(async () => undefined, {
|
|
157
|
+
cwd: dir,
|
|
158
|
+
compose: { cwd: dir, composePath, composeProject: "supatype-test" },
|
|
159
|
+
})
|
|
160
|
+
expect(hasComposeShutdownFallback()).toBe(true)
|
|
161
|
+
})
|
|
162
|
+
})
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { describe, expect, it, vi, beforeEach, afterEach, afterAll } from "vitest"
|
|
2
|
+
import type { SpawnSyncReturns } from "node:child_process"
|
|
3
|
+
|
|
4
|
+
const spawnSyncMock = vi.hoisted(() => vi.fn())
|
|
5
|
+
const isInteractiveMock = vi.hoisted(() => vi.fn(() => false))
|
|
6
|
+
const clackLogErrorMock = vi.hoisted(() => vi.fn())
|
|
7
|
+
const clackNoteMock = vi.hoisted(() => vi.fn())
|
|
8
|
+
const clackIntroMock = vi.hoisted(() => vi.fn())
|
|
9
|
+
const printLogoMock = vi.hoisted(() => vi.fn())
|
|
10
|
+
|
|
11
|
+
vi.mock("node:child_process", () => ({
|
|
12
|
+
spawnSync: spawnSyncMock,
|
|
13
|
+
}))
|
|
14
|
+
|
|
15
|
+
vi.mock("../src/ui/interactive.js", () => ({
|
|
16
|
+
isInteractive: isInteractiveMock,
|
|
17
|
+
}))
|
|
18
|
+
|
|
19
|
+
vi.mock("@clack/prompts", async (importOriginal) => {
|
|
20
|
+
const original = await importOriginal<typeof import("@clack/prompts")>()
|
|
21
|
+
return {
|
|
22
|
+
...original,
|
|
23
|
+
intro: clackIntroMock,
|
|
24
|
+
note: clackNoteMock,
|
|
25
|
+
log: {
|
|
26
|
+
...original.log,
|
|
27
|
+
error: clackLogErrorMock,
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
vi.mock("../src/ui/prompts.js", async (importOriginal) => {
|
|
33
|
+
const original = await importOriginal<typeof import("../src/ui/prompts.js")>()
|
|
34
|
+
return {
|
|
35
|
+
...original,
|
|
36
|
+
printLogo: printLogoMock,
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
import {
|
|
41
|
+
probeDockerDaemon,
|
|
42
|
+
reportDockerUnavailable,
|
|
43
|
+
requireDockerDaemon,
|
|
44
|
+
} from "../src/docker-runtime.js"
|
|
45
|
+
|
|
46
|
+
function spawnResult(
|
|
47
|
+
overrides: Partial<SpawnSyncReturns<string>> & Pick<SpawnSyncReturns<string>, "status">,
|
|
48
|
+
): SpawnSyncReturns<string> {
|
|
49
|
+
return {
|
|
50
|
+
stdout: "",
|
|
51
|
+
stderr: "",
|
|
52
|
+
pid: 0,
|
|
53
|
+
output: ["", ""],
|
|
54
|
+
signal: null,
|
|
55
|
+
...overrides,
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
describe("probeDockerDaemon", () => {
|
|
60
|
+
beforeEach(() => {
|
|
61
|
+
spawnSyncMock.mockReset()
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it("returns ok when docker version and info succeed", () => {
|
|
65
|
+
spawnSyncMock
|
|
66
|
+
.mockReturnValueOnce(spawnResult({ status: 0, stdout: "24.0.0" }))
|
|
67
|
+
.mockReturnValueOnce(spawnResult({ status: 0, stdout: "Server Version: 24.0.0" }))
|
|
68
|
+
|
|
69
|
+
expect(probeDockerDaemon()).toEqual({ ok: true })
|
|
70
|
+
expect(spawnSyncMock).toHaveBeenCalledTimes(2)
|
|
71
|
+
expect(spawnSyncMock.mock.calls[0]?.[1]).toEqual(["version", "--format", "{{.Client.Version}}"])
|
|
72
|
+
expect(spawnSyncMock.mock.calls[1]?.[1]).toEqual(["info"])
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it("returns cli_missing when docker is not on PATH", () => {
|
|
76
|
+
spawnSyncMock.mockReturnValueOnce(
|
|
77
|
+
spawnResult({ status: 1, error: Object.assign(new Error("spawn docker ENOENT"), { code: "ENOENT" }) }),
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
expect(probeDockerDaemon()).toEqual({ ok: false, reason: "cli_missing" })
|
|
81
|
+
expect(spawnSyncMock).toHaveBeenCalledTimes(1)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it("returns daemon_unavailable when info fails", () => {
|
|
85
|
+
spawnSyncMock
|
|
86
|
+
.mockReturnValueOnce(spawnResult({ status: 0, stdout: "24.0.0" }))
|
|
87
|
+
.mockReturnValueOnce(
|
|
88
|
+
spawnResult({
|
|
89
|
+
status: 1,
|
|
90
|
+
stderr: "Cannot connect to the Docker daemon at unix:///var/run/docker.sock",
|
|
91
|
+
}),
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
expect(probeDockerDaemon()).toEqual({
|
|
95
|
+
ok: false,
|
|
96
|
+
reason: "daemon_unavailable",
|
|
97
|
+
detail: "Cannot connect to the Docker daemon at unix:///var/run/docker.sock",
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
it("returns daemon_unavailable when version exits non-zero but client version is present (e.g. Docker paused)", () => {
|
|
102
|
+
spawnSyncMock.mockReturnValueOnce(
|
|
103
|
+
spawnResult({
|
|
104
|
+
status: 1,
|
|
105
|
+
stdout: "29.4.0\n",
|
|
106
|
+
stderr: "Error response from daemon: Docker Desktop is manually paused.",
|
|
107
|
+
}),
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
expect(probeDockerDaemon()).toEqual({
|
|
111
|
+
ok: false,
|
|
112
|
+
reason: "daemon_unavailable",
|
|
113
|
+
detail: "Error response from daemon: Docker Desktop is manually paused.",
|
|
114
|
+
})
|
|
115
|
+
expect(spawnSyncMock).toHaveBeenCalledTimes(1)
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
describe("reportDockerUnavailable", () => {
|
|
120
|
+
const errorMock = vi.spyOn(console, "error").mockImplementation(() => {})
|
|
121
|
+
const logMock = vi.spyOn(console, "log").mockImplementation(() => {})
|
|
122
|
+
|
|
123
|
+
beforeEach(() => {
|
|
124
|
+
isInteractiveMock.mockReturnValue(false)
|
|
125
|
+
errorMock.mockClear()
|
|
126
|
+
logMock.mockClear()
|
|
127
|
+
clackLogErrorMock.mockClear()
|
|
128
|
+
clackNoteMock.mockClear()
|
|
129
|
+
clackIntroMock.mockClear()
|
|
130
|
+
printLogoMock.mockClear()
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
afterAll(() => {
|
|
134
|
+
errorMock.mockRestore()
|
|
135
|
+
logMock.mockRestore()
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
it("uses [supatype] prefix on the headline via error()", () => {
|
|
139
|
+
reportDockerUnavailable({
|
|
140
|
+
ok: false,
|
|
141
|
+
reason: "daemon_unavailable",
|
|
142
|
+
detail: "Cannot connect to the Docker daemon",
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
expect(errorMock).toHaveBeenCalledWith(
|
|
146
|
+
"[supatype] Docker is installed but the daemon is not running.",
|
|
147
|
+
)
|
|
148
|
+
expect(logMock.mock.calls.some((call) => String(call[0]).includes('provider: "native"'))).toBe(true)
|
|
149
|
+
expect(logMock.mock.calls.some((call) => String(call[0]).includes("docker: Cannot connect"))).toBe(
|
|
150
|
+
false,
|
|
151
|
+
)
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
it("mentions unpause when daemon detail says paused", () => {
|
|
155
|
+
reportDockerUnavailable({
|
|
156
|
+
ok: false,
|
|
157
|
+
reason: "daemon_unavailable",
|
|
158
|
+
detail: "Error response from daemon: Docker Desktop is manually paused.",
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
expect(logMock.mock.calls.some((call) => String(call[0]).includes("Unpause Docker Desktop"))).toBe(
|
|
162
|
+
true,
|
|
163
|
+
)
|
|
164
|
+
expect(logMock.mock.calls.some((call) => String(call[0]).includes("docker:"))).toBe(false)
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
it("mentions install for cli_missing", () => {
|
|
168
|
+
reportDockerUnavailable({ ok: false, reason: "cli_missing" })
|
|
169
|
+
|
|
170
|
+
expect(errorMock).toHaveBeenCalledWith("[supatype] Docker is not installed or not on your PATH.")
|
|
171
|
+
expect(logMock.mock.calls.some((call) => String(call[0]).includes("docker-desktop"))).toBe(true)
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
it("uses Clack log + note in interactive mode", () => {
|
|
175
|
+
isInteractiveMock.mockReturnValue(true)
|
|
176
|
+
|
|
177
|
+
reportDockerUnavailable(
|
|
178
|
+
{
|
|
179
|
+
ok: false,
|
|
180
|
+
reason: "daemon_unavailable",
|
|
181
|
+
detail: "Error response from daemon: Docker Desktop is manually paused.",
|
|
182
|
+
},
|
|
183
|
+
{ brand: { intro: "Local development" } },
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
expect(printLogoMock).toHaveBeenCalled()
|
|
187
|
+
expect(clackIntroMock).toHaveBeenCalledWith("Local development")
|
|
188
|
+
expect(clackLogErrorMock).toHaveBeenCalledWith(
|
|
189
|
+
"Docker is installed but the daemon is not running.",
|
|
190
|
+
)
|
|
191
|
+
expect(clackNoteMock).toHaveBeenCalledWith(
|
|
192
|
+
expect.stringContaining("Unpause Docker Desktop"),
|
|
193
|
+
)
|
|
194
|
+
expect(errorMock).not.toHaveBeenCalled()
|
|
195
|
+
expect(logMock).not.toHaveBeenCalled()
|
|
196
|
+
})
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
describe("requireDockerDaemon", () => {
|
|
200
|
+
let exitMock: ReturnType<typeof vi.spyOn<typeof process, "exit">>
|
|
201
|
+
let errorMock: ReturnType<typeof vi.spyOn<typeof console, "error">>
|
|
202
|
+
|
|
203
|
+
beforeEach(() => {
|
|
204
|
+
spawnSyncMock.mockReset()
|
|
205
|
+
isInteractiveMock.mockReturnValue(false)
|
|
206
|
+
exitMock = vi.spyOn(process, "exit").mockImplementation((() => {}) as typeof process.exit)
|
|
207
|
+
errorMock = vi.spyOn(console, "error").mockImplementation(() => {})
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
afterEach(() => {
|
|
211
|
+
exitMock.mockRestore()
|
|
212
|
+
errorMock.mockRestore()
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
it("exits when the daemon is unavailable", () => {
|
|
216
|
+
spawnSyncMock
|
|
217
|
+
.mockReturnValueOnce(spawnResult({ status: 0, stdout: "24.0.0" }))
|
|
218
|
+
.mockReturnValueOnce(spawnResult({ status: 1, stderr: "daemon down" }))
|
|
219
|
+
|
|
220
|
+
requireDockerDaemon()
|
|
221
|
+
|
|
222
|
+
expect(errorMock).toHaveBeenCalled()
|
|
223
|
+
expect(exitMock).toHaveBeenCalledWith(1)
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
it("does not exit when docker is available", () => {
|
|
227
|
+
spawnSyncMock
|
|
228
|
+
.mockReturnValueOnce(spawnResult({ status: 0, stdout: "24.0.0" }))
|
|
229
|
+
.mockReturnValueOnce(spawnResult({ status: 0, stdout: "ok" }))
|
|
230
|
+
|
|
231
|
+
requireDockerDaemon()
|
|
232
|
+
|
|
233
|
+
expect(exitMock).not.toHaveBeenCalled()
|
|
234
|
+
expect(errorMock).not.toHaveBeenCalled()
|
|
235
|
+
})
|
|
236
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import {
|
|
3
|
+
filterComposeNoise,
|
|
4
|
+
formatEnginePushMessage,
|
|
5
|
+
parseEnginePushOutput,
|
|
6
|
+
} from "../src/engine-push-output.js"
|
|
7
|
+
|
|
8
|
+
describe("parseEnginePushOutput()", () => {
|
|
9
|
+
it("parses JSON on its own line amid docker progress", () => {
|
|
10
|
+
const output = [
|
|
11
|
+
" Container supatype-to-do-db-1 Running",
|
|
12
|
+
" Container supatype-to-do-db-1 Waiting",
|
|
13
|
+
" Container supatype-to-do-db-1 Healthy",
|
|
14
|
+
'{"status":"up_to_date","operations":0,"admin_refreshed":true}',
|
|
15
|
+
" Container supatype-to-do-schema-engine-run-abc Created",
|
|
16
|
+
].join("\n")
|
|
17
|
+
|
|
18
|
+
expect(parseEnginePushOutput(output)).toEqual({
|
|
19
|
+
status: "up_to_date",
|
|
20
|
+
operations: 0,
|
|
21
|
+
admin_refreshed: true,
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it("parses bare JSON output", () => {
|
|
26
|
+
expect(parseEnginePushOutput('{"status":"applied","operations":2}')).toEqual({
|
|
27
|
+
status: "applied",
|
|
28
|
+
operations: 2,
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it("returns null when no JSON present", () => {
|
|
33
|
+
expect(parseEnginePushOutput("engine failed: connection refused")).toBeNull()
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe("formatEnginePushMessage()", () => {
|
|
38
|
+
it("formats up_to_date with admin refresh", () => {
|
|
39
|
+
expect(
|
|
40
|
+
formatEnginePushMessage({ status: "up_to_date", operations: 0, admin_refreshed: true }),
|
|
41
|
+
).toBe("Schema up to date — Studio metadata synced.")
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it("formats up_to_date without admin refresh", () => {
|
|
45
|
+
expect(formatEnginePushMessage({ status: "up_to_date" })).toBe("Schema up to date.")
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it("formats applied operations", () => {
|
|
49
|
+
expect(formatEnginePushMessage({ status: "applied", operations: 3 })).toBe(
|
|
50
|
+
"Applied 3 operation(s).",
|
|
51
|
+
)
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
describe("filterComposeNoise()", () => {
|
|
56
|
+
it("removes container progress lines but keeps errors", () => {
|
|
57
|
+
const output = [
|
|
58
|
+
" Container supatype-to-do-db-1 Running",
|
|
59
|
+
"engine error: permission denied",
|
|
60
|
+
'{"status":"up_to_date","operations":0}',
|
|
61
|
+
].join("\n")
|
|
62
|
+
|
|
63
|
+
expect(filterComposeNoise(output)).toBe(
|
|
64
|
+
'engine error: permission denied\n{"status":"up_to_date","operations":0}',
|
|
65
|
+
)
|
|
66
|
+
})
|
|
67
|
+
})
|