import { spawnSync } from 'node:child_process' import { resolve } from 'node:path' import { describe, expect, it } from 'vitest' const root = resolve(import.meta.dirname, '..') describe('repository build CLI', () => { // The sentinel makes parseArgs fail fast if the check ever stops running first. it('rejects a Node process without TypeScript type stripping before any build step', () => { const result = spawnSync( process.execPath, ['--no-experimental-strip-types', '--import', 'tsx/esm', resolve(root, 'scripts/build.ts'), '--spec-sentinel'], { cwd: root, encoding: 'utf8' }, ) expect(result.status).not.toBe(0) expect(result.stderr).toContain('build: Node.js TypeScript type stripping is unavailable') }) it('rejects a value for the artifacts-only flag before any build step', () => { const result = spawnSync( process.execPath, ['--import', 'tsx/esm', resolve(root, 'scripts/build.ts'), '--artifacts-only=yes'], { cwd: root, encoding: 'utf8' }, ) expect(result.status).not.toBe(0) expect(result.stderr).toContain('does not take an argument') }) })