Skip to content

Commit a5958c7

Browse files
committed
test(ui): give the whole-tree scratch-dir sweep bases it can read in three ui/ script tests
The slow tier of `pnpm check:pm-dispatch-gates` runs only on push and schedule, and since the ui/ import it reads ui/ sources too. Two of its live-tree cases went red on three ui/ test files: - check-node-esm-load.test.ts binds `dir` to a temp directory in most tests and to `path.join(REPO_ROOT, 'packages/fields' | 'packages/auth')` in two. The sweep does not track scope and an in-tree reading wins, so every `mkdirSync(path.join(dir, ...))` read as a directory created in ui/packages/fields. The two package-reading tests now say `pkgDir`. - markdown-test-inputs.test.ts and select-affected-tests-wiring.test.ts declared `let scratch = ''` and assigned the real temp base in beforeAll. The empty literal read as a cwd-relative mkdtempSync base. They now declare `let scratch: string;`, so the one assignment is the only reading. No gate changes. Tests unchanged in behaviour (86/86). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HssnEmZ59WGARsErPSbRpf
1 parent e167956 commit a5958c7

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎ui/scripts/__tests__/check-node-esm-load.test.ts‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -369,24 +369,24 @@ describe('the scope this gate ratchets, now that the emit question is answered',
369369
// sources — so nothing live left the leg with it. The sources keep a
370370
// STRICTER guard than this heuristic: that config pins `nodenext`, under
371371
// which a missing relative extension is TS2835 in the package's own build.
372-
const dir = path.join(REPO_ROOT, 'packages/fields');
373-
const build = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8')).scripts.build;
372+
const pkgDir = path.join(REPO_ROOT, 'packages/fields');
373+
const build = JSON.parse(fs.readFileSync(path.join(pkgDir, 'package.json'), 'utf8')).scripts.build;
374374

375-
expect(effectiveNoEmit(path.join(dir, 'tsconfig.json'))).toBe(true);
376-
expect(buildPreservesSpecifiers(build, dir)).toBe(false);
377-
expect(parseTsconfig(path.join(dir, 'tsconfig.json')).compilerOptions?.noEmit).toBeUndefined();
375+
expect(effectiveNoEmit(path.join(pkgDir, 'tsconfig.json'))).toBe(true);
376+
expect(buildPreservesSpecifiers(build, pkgDir)).toBe(false);
377+
expect(parseTsconfig(path.join(pkgDir, 'tsconfig.json')).compilerOptions?.noEmit).toBeUndefined();
378378
});
379379

380380
it('keeps `@object-ui/auth` in the leg on its DECLARED noEmit, not on a catch', () => {
381381
// Its config throws under the old reader too, so it was in the leg by
382382
// accident. It declares `"noEmit": false` outright, so the verdict is
383383
// unchanged — what changes is that it is now a reading.
384-
const dir = path.join(REPO_ROOT, 'packages/auth');
385-
const build = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8')).scripts.build;
384+
const pkgDir = path.join(REPO_ROOT, 'packages/auth');
385+
const build = JSON.parse(fs.readFileSync(path.join(pkgDir, 'package.json'), 'utf8')).scripts.build;
386386

387-
expect(parseTsconfig(path.join(dir, 'tsconfig.json')).compilerOptions?.noEmit).toBe(false);
388-
expect(effectiveNoEmit(path.join(dir, 'tsconfig.json'))).toBe(false);
389-
expect(buildPreservesSpecifiers(build, dir)).toBe(true);
387+
expect(parseTsconfig(path.join(pkgDir, 'tsconfig.json')).compilerOptions?.noEmit).toBe(false);
388+
expect(effectiveNoEmit(path.join(pkgDir, 'tsconfig.json'))).toBe(false);
389+
expect(buildPreservesSpecifiers(build, pkgDir)).toBe(true);
390390
});
391391
});
392392

‎ui/scripts/__tests__/markdown-test-inputs.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const [TYPE_CHECK_STEP, TEST_STEP, DIST_PINS_STEP, E2E_STEP] = STEPS;
113113

114114
type Outcome = { shouldRun: string; log: string };
115115

116-
let scratch = '';
116+
let scratch: string;
117117

118118
function git(cwd: string, ...args: string[]): void {
119119
execFileSync('git', args, { cwd, stdio: 'pipe' });

‎ui/scripts/__tests__/select-affected-tests-wiring.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function parseOutputs(text: string): Record<string, string> {
134134
return outputs;
135135
}
136136

137-
let scratch = '';
137+
let scratch: string;
138138
const nodeDir = path.dirname(process.execPath);
139139

140140
/** Write an executable stand-in for `name` into a fresh bin directory. */

0 commit comments

Comments
 (0)