import { afterEach, expect, test } from 'bun:test' import { readFile, readdir } from 'node:fs/promises' import { join, resolve } from 'node:path' import { buildRegistry } from '../../registry/build.js' import { createIsolatedCliEnv } from '../spawn-cli.js' import { fixtureTracker, write, writeManifest } from './fixtures.js' const CLI_ENTRY = resolve(import.meta.dir, '../../bin/chkit.ts') const fixtures = fixtureTracker() const servers: Array> = [] afterEach(async () => { await Promise.all(servers.splice(0).map((server) => server.stop(true))) await fixtures.cleanup() }) test.serial('registry and add help work outside a project', async () => { const fixture = await fixtures.create() const [add, registry] = await Promise.all([ runCli(fixture.project, ['add', '--help']), runCli(fixture.project, ['registry', '--help']), ]) expect(add.exitCode).toBe(0) expect(add.stdout).toContain('chkit add ') expect(add.stdout).toContain('--dry-run') expect(add.stdout).toContain('--with-tests') expect(add.stdout).toContain('Browse apps with chkit registry list') expect(registry.exitCode).toBe(0) expect(registry.stdout).toContain('chkit registry ') expect(registry.stdout).toContain('inspect