@@ -212,6 +212,17 @@ export default defineStack({
212212
213213const dirs = { flip : '' , single : '' } ;
214214
215+ /** A cold `tsx` spawn of the CLI source entry, the per-case allowance this file always gave one. */
216+ const SPAWN_TIMEOUT_MS = 180_000 ;
217+
218+ /**
219+ * One run per distinct (command, flags, fixture) triple. The cases below used
220+ * to spawn `os build --json` on the flip fixture three times and `os lint
221+ * --json` on it three times; every case now reads the one run of its triple,
222+ * spawned in sequence in the `beforeAll` below.
223+ */
224+ const runs = { } as Record < 'buildFlip' | 'lintFlip' | 'lintStrictFlip' | 'buildSingle' | 'lintSingle' , Run > ;
225+
215226function plant ( config : string ) : string {
216227 const dir = mkdtempSync ( join ( tmpdir ( ) , 'os-lintpp-' ) ) ;
217228 mkdirSync ( join ( dir , 'src' ) , { recursive : true } ) ;
@@ -226,31 +237,36 @@ function plant(config: string): string {
226237}
227238
228239describe ( '#18778 — `os lint` and `os build` report the same per-package finding set' , ( ) => {
229- beforeAll ( ( ) => {
240+ beforeAll ( async ( ) => {
230241 dirs . flip = plant ( CONFIG_FLIP ) ;
231242 dirs . single = plant ( CONFIG_SINGLE ) ;
232- } ) ;
243+ runs . buildFlip = await runCli ( [ 'build' , '--json' ] , dirs . flip ) ;
244+ runs . lintFlip = await runCli ( [ 'lint' , '--json' ] , dirs . flip ) ;
245+ runs . lintStrictFlip = await runCli ( [ 'lint' , '--json' , '--strict' ] , dirs . flip ) ;
246+ runs . buildSingle = await runCli ( [ 'build' , '--json' ] , dirs . single ) ;
247+ runs . lintSingle = await runCli ( [ 'lint' , '--json' ] , dirs . single ) ;
248+ } , 5 * SPAWN_TIMEOUT_MS ) ;
233249
234250 afterAll ( ( ) => {
235251 for ( const dir of Object . values ( dirs ) ) if ( dir ) rmSync ( dir , { recursive : true , force : true } ) ;
236252 } ) ;
237253
238- it ( 'the fixture reaches the pass at all, and the UNION sees nothing — `os build` raises exactly the survivor' , async ( ) => {
254+ it ( 'the fixture reaches the pass at all, and the UNION sees nothing — `os build` raises exactly the survivor' , ( ) => {
239255 // Asserted BEFORE any claim about parity: a fixture that never reaches the
240256 // per-package pass makes every comparison below vacuous, and a fixture whose
241257 // union run raises the same finding makes the comparison an echo count.
242- const build = await runCli ( [ 'build' , '--json' ] , dirs . flip ) ;
258+ const build = runs . buildFlip ;
243259 expect ( build . code , `os build --json failed:\n${ build . stdout } ${ build . stderr } ` ) . toBe ( 0 ) ;
244260 const warnings = payloadOf ( build , 'os build --json' ) . warnings as unknown [ ] ;
245261 expect ( buildPerPackage ( warnings ) . length ) . toBeGreaterThan ( 0 ) ;
246262 // Nothing else: every warning on this fixture is a per-package survivor.
247263 expect ( warnings . length ) . toBe ( buildPerPackage ( warnings ) . length ) ;
248- } , 180_000 ) ;
264+ } ) ;
249265
250- it ( '`os lint` reports every per-package finding `os build` does' , async ( ) => {
266+ it ( '`os lint` reports every per-package finding `os build` does' , ( ) => {
251267 // The pin. On `origin/main` 7572329069 this read `build: 1, lint: 0`.
252- const build = await runCli ( [ 'build' , '--json' ] , dirs . flip ) ;
253- const lint = await runCli ( [ 'lint' , '--json' ] , dirs . flip ) ;
268+ const build = runs . buildFlip ;
269+ const lint = runs . lintFlip ;
254270 expect ( build . code , `os build --json failed:\n${ build . stdout } ${ build . stderr } ` ) . toBe ( 0 ) ;
255271 expect ( lint . code , `os lint --json failed:\n${ lint . stdout } ${ lint . stderr } ` ) . toBe ( 0 ) ;
256272
@@ -261,25 +277,25 @@ describe('#18778 — `os lint` and `os build` report the same per-package findin
261277 missing ,
262278 'these per-package findings ride `os build` and `os lint` cannot see them — the #18778 false-clean set' ,
263279 ) . toEqual ( [ ] ) ;
264- } , 180_000 ) ;
280+ } ) ;
265281
266- it ( '…and nothing per-package rides `os lint` that `os build` does not report either' , async ( ) => {
282+ it ( '…and nothing per-package rides `os lint` that `os build` does not report either' , ( ) => {
267283 // Parity is an equality. A lint that over-reports is its own defect — an
268284 // author fixing a finding the command that SHIPS never raises.
269- const build = await runCli ( [ 'build' , '--json' ] , dirs . flip ) ;
270- const lint = await runCli ( [ 'lint' , '--json' ] , dirs . flip ) ;
285+ const build = runs . buildFlip ;
286+ const lint = runs . lintFlip ;
271287 const inBuild = new Set ( buildPerPackage ( payloadOf ( build , 'os build --json' ) . warnings as unknown [ ] ) ) ;
272288 expect ( lintPerPackage ( payloadOf ( lint , 'os lint --json' ) . issues as unknown [ ] ) . filter ( ( w ) => ! inBuild . has ( w ) ) ) . toEqual ( [ ] ) ;
273- } , 180_000 ) ;
289+ } ) ;
274290
275- it ( '⚠️ THE NARROWING — `os lint --strict` now EXITS 1 on a project it exited 0 for' , async ( ) => {
291+ it ( '⚠️ THE NARROWING — `os lint --strict` now EXITS 1 on a project it exited 0 for' , ( ) => {
276292 // The Clause-② evidence, pinned so it can neither regress silently nor widen
277293 // silently. `--strict` is documented as "treat warnings as errors", and a
278294 // per-package advisory is a warning this door could not see before, so the
279295 // verdict moves with it. ⛔ The DEFAULT face is deliberately NOT asserted to
280296 // move: no `error`-severity per-package-only finding was exhibited on this
281297 // fixture, and a pin asserting one would be asserting something unmeasured.
282- const strict = await runCli ( [ 'lint' , '--json' , '--strict' ] , dirs . flip ) ;
298+ const strict = runs . lintStrictFlip ;
283299 const payload = payloadOf ( strict , 'os lint --json --strict' ) ;
284300 expect ( payload . strict ) . toBe ( true ) ;
285301 expect ( payload . failing ) . toBe ( 1 ) ;
@@ -288,21 +304,21 @@ describe('#18778 — `os lint` and `os build` report the same per-package findin
288304
289305 // …and the same project without `--strict` still exits 0, so what moved is
290306 // the strict verdict and not the default one.
291- const plain = await runCli ( [ 'lint' , '--json' ] , dirs . flip ) ;
307+ const plain = runs . lintFlip ;
292308 expect ( plain . code ) . toBe ( 0 ) ;
293309 expect ( payloadOf ( plain , 'os lint --json' ) . passed ) . toBe ( true ) ;
294- } , 180_000 ) ;
310+ } ) ;
295311
296- it ( 'CONTROL — a single-package project raises NO per-package finding on either door' , async ( ) => {
312+ it ( 'CONTROL — a single-package project raises NO per-package finding on either door' , ( ) => {
297313 // "Present" must be distinguishable from "always present": the prefix this
298314 // file matches on is not something either command emits unconditionally, and
299315 // `os lint --strict` still exits 1 there for the ORDINARY warning, which is
300316 // how the case above is read as a change and not as a constant.
301- const build = await runCli ( [ 'build' , '--json' ] , dirs . single ) ;
302- const lint = await runCli ( [ 'lint' , '--json' ] , dirs . single ) ;
317+ const build = runs . buildSingle ;
318+ const lint = runs . lintSingle ;
303319 expect ( build . code , `os build --json failed:\n${ build . stdout } ${ build . stderr } ` ) . toBe ( 0 ) ;
304320 expect ( lint . code , `os lint --json failed:\n${ lint . stdout } ${ lint . stderr } ` ) . toBe ( 0 ) ;
305321 expect ( buildPerPackage ( payloadOf ( build , 'os build --json' ) . warnings as unknown [ ] ) ) . toEqual ( [ ] ) ;
306322 expect ( lintPerPackage ( payloadOf ( lint , 'os lint --json' ) . issues as unknown [ ] ) ) . toEqual ( [ ] ) ;
307- } , 180_000 ) ;
323+ } ) ;
308324} ) ;
0 commit comments