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
3 changes: 2 additions & 1 deletion packages/cli/test/helpers/serve-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export const TSX = resolve(HERE, '../../../../node_modules/.bin/tsx');
export const RUN_JS_RESOLVES_FROM_DIST =
'This file spawns bin/run.js with NODE_ENV unset, which is what makes oclif resolve the ' +
'command from dist/ instead of transpiling src/ — so on an unbuilt tree the child answers ' +
'"command serve not found" and every boot below times out.';
'"command serve not found" and every boot below fails immediately with "serve exited 2", ' +
'not a timeout.';

/**
* The refusal itself, separated from the check so its WORDING can be pinned.
Expand Down
14 changes: 9 additions & 5 deletions packages/cli/test/serve-built-cli-prerequisite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,19 @@ describe('#12539: the unbuilt-CLI refusal is legible', () => {
expect(message).not.toContain('transpiling src/');
});

it('reproduces, byte for byte, what the three private copies threw before the hoist', () => {
// #12539 moved this refusal out of three files; it did not reword it. The
// literal below is the message measured on `09b4f4e4e`, so a rewording has
// to be a deliberate edit here rather than a side effect of the move.
it('pins the whole refusal, byte for byte', () => {
// #12539 moved this refusal out of three files without rewording it, and
// the literal below was the message measured on `09b4f4e4e`. #12618 then
// reworded ONE clause — `every boot below times out` was false; the child
// exits 2 at once — and this literal moved in the SAME commit, which is
// the pin doing its job: a rewording has to be a deliberate edit here
// rather than a side effect of a move.
expect(unbuiltCliError('/repo/packages/cli/dist/commands/serve.js', RUN_JS_RESOLVES_FROM_DIST).message).toBe(
'packages/cli is not built: /repo/packages/cli/dist/commands/serve.js does not exist.\n' +
'This file spawns bin/run.js with NODE_ENV unset, which is what makes oclif resolve the ' +
'command from dist/ instead of transpiling src/ — so on an unbuilt tree the child answers ' +
'"command serve not found" and every boot below times out.\n' +
'"command serve not found" and every boot below fails immediately with "serve exited 2", ' +
'not a timeout.\n' +
'CI declares the build (turbo: @objectstack/cli#test dependsOn build); a direct vitest run does not.\n' +
'Run: pnpm exec turbo run build --filter=@objectstack/cli',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ const CLI = resolve(HERE, '../bin/run.js');
* Why THIS file needs `packages/cli/dist`, in its own terms (#12539).
*
* ⛔ NOT `RUN_JS_RESOLVES_FROM_DIST`, the constant the three sibling spawners
* pass. That sentence ends `… and every boot below times out`, which holds for
* a file whose every boot goes through `bin/run.js` with `NODE_ENV` unset.
* pass. That sentence ends `… and every boot below fails immediately with
* "serve exited 2", not a timeout`, which holds for a file whose every boot
* goes through `bin/run.js` with `NODE_ENV` unset.
* This file is not one: of its three legs only the unset pin resolves from
* `dist/`, and the other two hand the child `development`/`test` — exactly the
* value that makes `@oclif/core`'s `isProd()` false and reroutes them to
Expand Down
Loading