Skip to content

Commit 76284b1

Browse files
hotlongclaude
andcommitted
test(cli): the e2e fixtures the live console manifest refuses move from div to box, and the notice cases name their precondition
Claude-Session: https://claude.ai/code/session_local_1d2a197c-c20e-4e90-9be8-413d4d432289 Co-authored-by: Claude <noreply@anthropic.com>
1 parent f61057c commit 76284b1

4 files changed

Lines changed: 33 additions & 6 deletions

‎packages/cli/test/build-json-failure-conversions.e2e.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ function payloadOf(run: Run, label: string): Record<string, unknown> {
123123
* A stack whose `pages[0].kind` drives the live conversion. `pageKind` is a
124124
* parameter so the negative control can run the identical shape with the
125125
* CANONICAL spelling, where there is nothing to convert.
126+
*
127+
* The page is `<box>`, not `<div>`: where the CLI reaches the manifest
128+
* `@objectstack/console` ships, the html tier refuses `div` (#19922), and that
129+
* would add an author-time error no exit here is about.
126130
*/
127131
function stack(ns: string, opts: { pageKind?: string; requires?: string[]; extraFields?: string; extraTop?: string } = {}): string {
128132
const { pageKind = 'jsx', requires = [], extraFields = '', extraTop = '' } = opts;
@@ -132,7 +136,7 @@ import { defineStack } from '@objectstack/spec';
132136
export default defineStack({
133137
manifest: { id: 'com.example.${ns}', name: '${ns}', version: '1.0.0', type: 'app', namespace: '${ns}' },
134138
requires: [${requires.map((r) => `'${r}'`).join(', ')}],
135-
pages: [{ name: 'landing', label: 'Landing', kind: '${pageKind}', source: '<div>hi</div>' }],
139+
pages: [{ name: 'landing', label: 'Landing', kind: '${pageKind}', source: '<box>hi</box>' }],
136140
objects: [
137141
{
138142
name: '${ns}_ticket',

‎packages/cli/test/jsx-gate-manifest-notice.e2e.test.ts‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,34 @@
4242

4343
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
4444
import { execFile } from 'node:child_process';
45-
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
45+
import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
4646
import { tmpdir } from 'node:os';
4747
import { join, resolve } from 'node:path';
4848
import { fileURLToPath } from 'node:url';
4949
import { childEnv } from './helpers/serve-process.js';
5050
import { linkSpec } from './helpers/define-stack-fixture.js';
51+
import { consoleSduiManifestPath } from '../src/utils/sdui-manifest.js';
5152

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

57+
/**
58+
* Whether the manifest-less path is reachable in THIS checkout (#19922). With
59+
* no project manifest the CLI falls back to the copy its own
60+
* `@objectstack/console` dependency ships, located from the same module the
61+
* spawned CLI runs (`src/`, through `bin/run-dev.js`). In the workspace that is
62+
* `packages/console/dist/sdui.manifest.json`, which exists only where the
63+
* console has been built — never in the CI job that runs this file, often on a
64+
* developer's machine. Where it exists, a project without a manifest is fully
65+
* validated against it and the notice has nothing to report, so the cases that
66+
* need "no manifest anywhere" are SKIPPED, by name, rather than asserting a
67+
* state this checkout cannot produce. Every rule they pin is also pinned,
68+
* hermetically, in `src/utils/sdui-manifest.test.ts`.
69+
*/
70+
const CONSOLE_COPY = consoleSduiManifestPath();
71+
const NO_MANIFEST_UNREACHABLE = CONSOLE_COPY !== undefined && existsSync(CONSOLE_COPY);
72+
5673
/** `JSX_PARSE_LEVEL_ONLY_RULE` in `src/utils/sdui-manifest.ts`, spelled out as the published anchor. */
5774
const RULE = 'sdui/jsx-parse-level-only';
5875

@@ -259,7 +276,7 @@ afterAll(() => {
259276
if (root) rmSync(root, { recursive: true, force: true });
260277
});
261278

262-
describe('no manifest, kind:html pages — the notice, exit status unchanged', () => {
279+
describe.skipIf(NO_MANIFEST_UNREACHABLE)('no manifest, kind:html pages — the notice, exit status unchanged', () => {
263280
it.each([
264281
['validate', '--strict'],
265282
['build'],
@@ -364,7 +381,7 @@ describe('[round 1] html pages carried only in packages[], beside a top-level pa
364381
COMMANDS.map((command) => [layout, command, notice, malformed] as const),
365382
);
366383

367-
it.each(rows)('%s — os %s: the notice, counting the package page, exit 0', (_layout, command, notice) => {
384+
it.skipIf(NO_MANIFEST_UNREACHABLE).each(rows)('%s — os %s: the notice, counting the package page, exit 0', (_layout, command, notice) => {
368385
const r = run(notice, command, '--json');
369386
expect(r.code, r.stdout + r.stderr).toBe(0);
370387
const notices = noticesIn(payloadOf(r, `${notice} ${command}`));

‎packages/cli/test/lint-conversion-notices.e2e.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,15 @@ function payloadOf(run: Run, label: string): Record<string, unknown> {
123123
*
124124
* `source` is a single-root element: the `jsx-no-root` authoring rule rejects a
125125
* bare string, so a fixture that used one would never reach the exit under test.
126+
* It is `<box>`, not `<div>`: where the CLI reaches the manifest
127+
* `@objectstack/console` ships, the html tier refuses `div` (#19922).
126128
*/
127129
function stack(ns: string, opts: { pageKind?: string } = {}): string {
128130
const { pageKind = 'jsx' } = opts;
129131
return `
130132
export default {
131133
manifest: { id: 'com.example.${ns}', name: '${ns}', version: '1.0.0', type: 'app', namespace: '${ns}' },
132-
pages: [{ name: 'landing', label: 'Landing', kind: '${pageKind}', source: '<div>hi</div>' }],
134+
pages: [{ name: 'landing', label: 'Landing', kind: '${pageKind}', source: '<box>hi</box>' }],
133135
objects: [
134136
{
135137
name: '${ns}_ticket',

‎packages/cli/test/validate-json-failure-conversions.e2e.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ function payloadOf(run: Run, label: string): Record<string, unknown> {
152152
* A stack whose `pages[0].kind` drives the live conversion. `pageKind` is a
153153
* parameter so the negative control can run the identical shape with the
154154
* CANONICAL spelling, where there is nothing to convert.
155+
*
156+
* The page is `<box>`, not `<div>`: where the CLI reaches the manifest
157+
* `@objectstack/console` ships, the html tier refuses `div` (#19922), and that
158+
* would add an author-time error no exit here is about.
155159
*/
156160
function stack(ns: string, opts: { pageKind?: string; requires?: string[]; extraFields?: string } = {}): string {
157161
const { pageKind = 'jsx', requires = [], extraFields = '' } = opts;
@@ -161,7 +165,7 @@ import { defineStack } from '@objectstack/spec';
161165
export default defineStack({
162166
manifest: { id: 'com.example.${ns}', name: '${ns}', version: '1.0.0', type: 'app', namespace: '${ns}' },
163167
requires: [${requires.map((r) => `'${r}'`).join(', ')}],
164-
pages: [{ name: 'landing', label: 'Landing', kind: '${pageKind}', source: '<div>hi</div>' }],
168+
pages: [{ name: 'landing', label: 'Landing', kind: '${pageKind}', source: '<box>hi</box>' }],
165169
objects: [
166170
{
167171
name: '${ns}_ticket',

0 commit comments

Comments
 (0)