Files
houseplan-card/test/gate-small.test.mjs
T
Claude 7195ad1914 infra: heavy CI gates on the beta candidate, bundle rebase script, gate:small
Validate ran three smoke shards, golden and performance_smoke on every push,
check-docs went red on any src/** change until screenshots were re-captured,
and a parallel bundle build made every second task branch fail to rebase.
None of these gates ever failed at review time; they fail before betas.

- `heavy` output in job `changes` (scripts/classify-changes.mjs): smoke,
  smoke_done, golden, performance_smoke run only for a head commit with a
  `Release:` trailer, `workflow_dispatch full=true` and pull requests.
- nightly.yml dispatches Validate on dev with full=true every night.
- check-docs `--screenshots=warn|strict`: freshness of the screenshot index
  warns on a plain push, errors on the candidate; everything else still errors.
- publish-prerelease.yml and release.yml refuse a candidate without the
  `Release:` trailer and (prerelease) require fresh screenshots — a green
  Validate without the heavy jobs cannot pass for a release.
- scripts/rebase-on-dev.mjs: rebase on origin/dev taking dev's copy of the
  committed bundle, rebuild with bundle:sync, amend; any other conflict aborts.
- npm run gate:small: mandatory PROCESS §8 part in one parallel run.

Issue: #479
User-Visible: no
2026-09-06 15:39:34 +03:00

36 lines
2.0 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { parseArgs, parallelSteps, serialSteps, summarize } from '../scripts/gate-small.mjs';
// #479 AC6: одна команда вместо списка §8 — состав обязательной части закреплён,
// информационный шаг (smoke-select) не считается падением, сверка бандла идёт
// после сборки.
test('gate:small гоняет обязательную часть PROCESS §8 и сверяет бандл (#479)', () => {
const names = parallelSteps('origin/dev').map((s) => `${s.cmd} ${s.args.join(' ')}`);
assert.ok(names.some((n) => n.endsWith('npm test') || n.endsWith('npm.cmd test')));
assert.ok(names.some((n) => n.includes('run build')));
assert.ok(names.some((n) => n.includes('scripts/no-new-any.mjs --base origin/dev --head HEAD')));
assert.ok(names.some((n) => n.includes('scripts/smoke-select.mjs --base origin/dev --head HEAD')));
const serial = serialSteps().map((s) => s.args.join(' '));
assert.ok(serial.some((s) => s.includes('bundle-tree.mjs dist custom_components/houseplan/frontend')));
assert.ok(serial.some((s) => s.includes('bundle:budget')));
assert.equal(parseArgs(['--base=abc']).base, 'abc');
assert.equal(parseArgs([]).base, 'origin/dev');
assert.equal(JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).scripts['gate:small'],
'node scripts/gate-small.mjs');
});
test('сводка: информационный шаг не падение, упавший шаг с подсказкой (#479)', () => {
const { lines, failed } = summarize([
{ name: 'a', code: 0, ms: 1000 },
{ name: 'select', code: 1, ms: 10, informational: true },
{ name: 'bundle', code: 1, ms: 10, hint: 'npm run bundle:sync' },
]);
assert.equal(failed, 1);
assert.match(lines[0], /^ok /);
assert.match(lines[1], /^info/);
assert.match(lines[2], /^FAIL.*→ npm run bundle:sync/);
});