Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
* number only exists once Node has exited and the kernel has masked it to
* `& 0xFF`. `test/migrate-exit-code.e2e.test.ts` is the precedent and states
* this in the same words — the audience `--json` exists for reads the SHELL, so
* that is what gets asserted. Spawned through `bin/run-dev.js` + tsx, so the
* that is what gets asserted. Spawned through `bin/run-dev.js` + `node`, so the
* suite does not depend on `packages/cli/dist` having been built.
*
* ## Why this file is not beside its siblings in `packages/cli/test/`
Expand Down Expand Up @@ -143,7 +143,6 @@ function linkSpec(dir: string): void {

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../../bin/run-dev.js');
const TSX = resolve(HERE, '../../../../node_modules/.bin/tsx');

/**
* The test-only live conversion the child loads with `--import` (its header
Expand Down Expand Up @@ -230,7 +229,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{
cwd,
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/test/build-callable-names.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*
* Each kind's fixture carries both collisions against an authored `functions`
* entry (a shared function; an equal name) under disjoint names, round-trips
* through `objectstack build` (`bin/run-dev.js`, source via tsx) and then the
* through `objectstack build` (`bin/run-dev.js`, source under `node`) and then the
* runtime's own `loadArtifactBundle`, and asserts that each authored name ships
* under itself and answers its own code, and that each hook or action ref
* answers its own code. Every callable names a module-scope constant, so no
Expand All @@ -66,9 +66,8 @@ import { locateCallables } from '../src/utils/build-runtime.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');
const LOWER_CALLABLES = resolve(HERE, '../src/utils/lower-callables.ts');
/** A cold `tsx` spawn of the CLI source entry runs well past vitest's 5 s default. */
/** A cold spawn of the CLI source entry runs well past vitest's 5 s default. */
const SPAWN_TIMEOUT_MS = 120_000;

// ── The census ──────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -258,7 +257,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* are kept. The control for the refusal is the same stack with the file
* present, which both commands accept.
*
* Runs the CLI from source (`bin/run-dev.js` through tsx), as the other build
* Runs the CLI from source (`bin/run-dev.js` under `node`), as the other build
* suites do, so `compile.ts` and `validate.ts` are measured without a rebuild.
*/

Expand All @@ -25,7 +25,6 @@ import { linkSpec } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

const DOCUMENT = {
openapi: '3.0.3',
Expand Down Expand Up @@ -72,7 +71,7 @@ afterAll(() => {
function run(command: 'build' | 'validate', cwd: string): Promise<{ code: number; stdout: string; stderr: string }> {
return new Promise((done) => {
execFile(
TSX,
process.execPath,
[CLI, command, '--json'],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) =>
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/test/build-demo-staff-artifact.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* `functions` entry runs, so a green here is "this one key was left out", not
* "the build wrote nothing".
*
* Runs the CLI from source (`bin/run-dev.js` through tsx), as the other build
* Runs the CLI from source (`bin/run-dev.js` under `node`), as the other build
* suites do, so `compile.ts` is measured without a rebuild.
*/

Expand All @@ -39,7 +39,6 @@ import { linkSpec } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');
const RUNTIME_MODULE = /^objectstack-runtime\.[a-f0-9]+\.mjs$/;

const STAFF_EMAIL = 'counsel1@legal.example';
Expand Down Expand Up @@ -79,7 +78,7 @@ afterAll(() => {
function build(cwd: string): Promise<{ code: number; stdout: string; stderr: string }> {
return new Promise((done) => {
execFile(
TSX,
process.execPath,
[CLI, 'build', '--json'],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) =>
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/test/build-docs-step-count.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* and the `--json` face must stay one JSON document, so the machine face is
* asserted to parse and to carry no step text at all.
*
* ALTITUDE: this spawns the CLI (`bin/run-dev.js` through tsx) rather than
* ALTITUDE: this spawns the CLI (`bin/run-dev.js` under `node`) rather than
* calling a helper, because the defect is in the ORDER of two statements inside
* the command body — there is no seam below the process that can observe it.
* Same spawn shape and the same `childEnv()` as
Expand All @@ -62,7 +62,6 @@ import { linkSpec } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

interface Run {
code: number;
Expand All @@ -73,7 +72,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/test/build-runtime-bundle-bodyless.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* `functions` entry resolving to a callable that runs through the runtime's own
* artifact loader (`loadArtifactBundle`, which merges the module's `functions`).
*
* The CLI runs through `bin/run-dev.js` (source, via tsx). Its dependencies,
* The CLI runs through `bin/run-dev.js` (source, under `node`). Its dependencies,
* `@objectstack/runtime` included, resolve through `exports` to `dist/`.
*/

Expand All @@ -44,8 +44,7 @@ import { linkSpec } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');
/** A cold `tsx` spawn of the CLI source entry runs well past vitest's 5 s default. */
/** A cold spawn of the CLI source entry runs well past vitest's 5 s default. */
const SPAWN_TIMEOUT_MS = 120_000;

interface Run {
Expand All @@ -57,7 +56,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/test/build-seed-files-artifact.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* and SHA-256 under `files`, keyed by the path. The control for the refusal is
* the same stack with the file present, which both commands accept.
*
* Runs the CLI from source (`bin/run-dev.js` through tsx), as the other build
* Runs the CLI from source (`bin/run-dev.js` under `node`), as the other build
* suites do, so `compile.ts` and `validate.ts` are measured without a rebuild.
*/

Expand All @@ -28,7 +28,6 @@ import { linkSpec } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

const PDF = '%PDF-1.7 a seeded contract';

Expand Down Expand Up @@ -76,7 +75,7 @@ afterAll(() => {
function run(command: 'build' | 'validate', cwd: string): Promise<{ code: number; stdout: string; stderr: string }> {
return new Promise((done) => {
execFile(
TSX,
process.execPath,
[CLI, command, '--json'],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) =>
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/test/build-strict-body-count.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* This file pins the door: the header's number, and the `--json` list, on the
* real command.
*
* The CLI runs through `bin/run-dev.js` (source, via tsx). Its dependencies
* The CLI runs through `bin/run-dev.js` (source, under `node`). Its dependencies
* resolve through `exports` to `dist/`.
*/

Expand All @@ -36,8 +36,7 @@ import { defineStackSourceFromLiteral, linkSpec } from './helpers/define-stack-f

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');
/** A cold `tsx` spawn of the CLI source entry runs well past vitest's 5 s default. */
/** A cold spawn of the CLI source entry runs well past vitest's 5 s default. */
const SPAWN_TIMEOUT_MS = 120_000;

interface Run {
Expand All @@ -49,7 +48,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/test/build-view-container-name.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* actually throws for the same payload, driven through `ObjectQL.registerApp`,
* rather than a literal copy of the words.
*
* The CLI runs through `bin/run-dev.js` (source, via tsx); its dependencies —
* The CLI runs through `bin/run-dev.js` (source, under `node`); its dependencies —
* `@objectstack/objectql` among them — resolve through `exports` to `dist/`.
*/

Expand All @@ -42,8 +42,7 @@ import { defineStackSource, linkSpec } from './helpers/define-stack-fixture.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');
/** A cold `tsx` spawn of the CLI source entry runs well past vitest's 5 s default. */
/** A cold spawn of the CLI source entry runs well past vitest's 5 s default. */
const SPAWN_TIMEOUT_MS = 120_000;
/** `os build`'s default `--output`, relative to the working directory. */
const ARTIFACT = join('dist', 'objectstack.json');
Expand All @@ -57,7 +56,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* length rule into the shared validator would break `init` for a name npm
* accepts; this test is what says so.
*
* Spawned through `bin/run-dev.js` + tsx, so the suite does not depend on
* Spawned through `bin/run-dev.js` + `node`, so the suite does not depend on
* `packages/cli/dist` having been built — `@objectstack/cli#test` depends on
* `^build` only (the reason `invocation-loudness.e2e.test.ts` spawns that way).
*/
Expand All @@ -67,9 +67,8 @@ import { NPM_PACKAGE_NAME_MAX_LENGTH, validateProjectName } from '../src/command

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

/** oclif + tsx cold start with every command module loaded; ~2-10 s when healthy. */
/** oclif cold start with every command module loaded; ~2-10 s when healthy. */
const RUN_TIMEOUT_MS = 180_000;

/** The card's input: a capital and a space, both npm-invalid. */
Expand All @@ -93,7 +92,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 8 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/test/dev-no-watch.pin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

const PACKAGE_ROOT = resolve(HERE, '..');

Expand Down Expand Up @@ -108,7 +107,7 @@ function derivePackageManagerPin(): string {
return `pnpm@${answer}`;
}

/** oclif + tsx cold start, with every command module loaded; ~2-10 s when healthy. */
/** oclif cold start, with every command module loaded; ~2-10 s when healthy. */
const RUN_TIMEOUT_MS = 180_000;

/** What the fixture workspace's own `dev` script prints — proof it ran. */
Expand All @@ -134,7 +133,7 @@ interface Run {
function runDev(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, 'dev', ...args],
{ cwd, maxBuffer: 8 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down Expand Up @@ -236,7 +235,7 @@ beforeAll(async () => {
})}\n`,
);

// Sequential on purpose: three cold tsx starts, each loading every command
// Sequential on purpose: three cold CLI starts, each loading every command
// module, in a container several agents share.
watchEqualsFalse = await runDev(['--watch=false'], projectDir);
noWatchAtWorkspace = await runDev(['--no-watch'], workspaceDir);
Expand Down
17 changes: 8 additions & 9 deletions packages/cli/test/generate-agent-retired.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* `invocation-loudness.e2e.test.ts` documents at length: `process.exitCode`
* inside a vitest worker is not an exit status (a CI script judges this
* command by `$?`), and these commands print through `utils/format.ts`, whose
* `printError` writes to stdout. Spawned through `bin/run-dev.js` + tsx so the
* `printError` writes to stdout. Spawned through `bin/run-dev.js` + `node` so the
* suite does not depend on `packages/cli/dist` having been built.
*
* The refusal's pointer at skills is asserted here only as TEXT. That the
Expand All @@ -41,9 +41,8 @@ import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

/** oclif + tsx cold start, with every command module loaded; ~2-10 s when healthy. */
/** oclif cold start, with every command module loaded; ~2-10 s when healthy. */
const RUN_TIMEOUT_MS = 180_000;

interface Run {
Expand All @@ -52,10 +51,10 @@ interface Run {
stderr: string;
}

function runTsx(args: string[], cwd: string): Promise<Run> {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
args,
{ cwd, maxBuffer: 8 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down Expand Up @@ -83,11 +82,11 @@ let survivor: Run;
beforeAll(async () => {
dir = mkdtempSync(join(tmpdir(), 'os-g-agent-retired-'));

// Sequential on purpose: three cold tsx starts, each loading every command
// Sequential on purpose: three cold CLI starts, each loading every command
// module, in a container several agents share.
retired = await runTsx([CLI, 'g', 'agent', 'support'], dir);
unknown = await runTsx([CLI, 'g', 'nonexistent-type', 'support'], dir);
survivor = await runTsx([CLI, 'g', 'object', 'customer', '--dry-run'], dir);
retired = await runCli([CLI, 'g', 'agent', 'support'], dir);
unknown = await runCli([CLI, 'g', 'nonexistent-type', 'support'], dir);
survivor = await runCli([CLI, 'g', 'object', 'customer', '--dry-run'], dir);
}, RUN_TIMEOUT_MS);

afterAll(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* Projects live under this package's `node_modules`, so a config's
* `@objectstack/spec` import resolves to the workspace copy without an
* install. Spawned through `bin/run-dev.js` + tsx, so the suite does not
* install. Spawned through `bin/run-dev.js` + `node`, so the suite does not
* depend on `packages/cli/dist`. Commands print through `utils/format.ts`,
* which writes to stdout, so stdout is what is read.
*/
Expand All @@ -41,9 +41,8 @@ import { childEnv } from './helpers/serve-process.js';

const HERE = dirname(fileURLToPath(import.meta.url));
const CLI = resolve(HERE, '../bin/run-dev.js');
const TSX = resolve(HERE, '../../../node_modules/.bin/tsx');

/** oclif + tsx cold starts, eight of them, sequential. */
/** oclif cold starts, eight of them, sequential. */
const RUN_TIMEOUT_MS = 300_000;

interface Run {
Expand All @@ -55,7 +54,7 @@ interface Run {
function runCli(args: string[], cwd: string): Promise<Run> {
return new Promise((resolvePromise) => {
execFile(
TSX,
process.execPath,
[CLI, ...args],
{ cwd, maxBuffer: 8 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
Expand Down Expand Up @@ -106,7 +105,7 @@ beforeAll(async () => {
read(join(dirs.broken, 'src', 'objects', 'index.ts')) + "export { default as legacy } from './legacy.object';\n",
);

// Sequential on purpose: cold tsx starts in a container several agents share.
// Sequential on purpose: cold CLI starts in a container several agents share.
runs.generate = await runCli(['g', 'object', 'order_line'], dirs.namespaced);
runs.prefixed = await runCli(['g', 'object', 'my_app_invoice'], dirs.namespaced);
runs.legacyForm = await runCli(['g', 'object', 'order__line'], dirs.namespaced);
Expand Down
Loading
Loading