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
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import fs from 'node:fs';
import path from 'node:path';
import { expect, test } from 'vitest';
import { walkFiles } from '../../scripts/lib/walk-files.ts';
import { runCmdSync } from '../utils/exec.ts';
import { walkFiles } from '../lib/walk-files.ts';
import { runCmdSync } from '../../src/utils/exec.ts';

/**
* Test-file size ratchet (AGENTS.md "Scope & shape": past 1,000 lines is architecture debt,
Expand Down
14 changes: 14 additions & 0 deletions scripts/mutation/modules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { fileURLToPath } from 'node:url';
import {
affectedModules,
ALL_MODULE_IDS,
isKernelTestFile,
KERNEL_MODULES,
moduleForFile,
mutateGlobs,
Expand Down Expand Up @@ -75,3 +76,16 @@ test('the shard matrix slices only the modules that declare shards', () => {
);
}
});

test('a kernel test is reachable only under root or package src', () => {
// Load-bearing for where `test-file-size-ratchet.test.ts` lives. It measures the
// repository's own files and git history, neither of which Stryker's sandbox copy can
// answer, so it sits in `scripts/__tests__/` (explicitly included by `unit-core`) and
// this predicate is what keeps it out of every mutation lane. Widening the pattern to
// scripts/ would silently pull it back in and fail every dry run.
assert.ok(isKernelTestFile('src/daemon/__tests__/ref-frame.test.ts'));
assert.ok(isKernelTestFile('packages/selectors/src/parse.test.ts'));
assert.ok(!isKernelTestFile('scripts/__tests__/test-file-size-ratchet.test.ts'));
assert.ok(!isKernelTestFile('test/integration/daemon.test.ts'));
assert.ok(!isKernelTestFile('src/daemon/ref-frame.ts'));
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type AndroidSettingsWorld = Awaited<ReturnType<typeof createAndroidSettingsWorld
* The adb evidence the Android settings flow must leave behind: the appearance, location,
* fingerprint, permission, animation-scale, and network mutations each named with the exact
* argv the provider saw. Extracted from `android-lifecycle.test.ts`, which sits over the
* test-file tripwire (`src/__tests__/test-file-size-ratchet.test.ts`).
* test-file tripwire (`scripts/__tests__/test-file-size-ratchet.test.ts`).
*/
export function assertAndroidSettingsContract(world: AndroidSettingsWorld): void {
const { adbCalls } = world;
Expand Down
7 changes: 7 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ export default defineConfig({
'scripts/__tests__/help-conformance-expectation-falsification.test.ts',
'scripts/__tests__/help-conformance-sample-outputs.test.ts',
'scripts/__tests__/help-conformance-topic-coverage.test.ts',
// Lives here rather than under src/ on purpose: it measures the repository's own
// files and git history, which Stryker's sandbox copy cannot answer (the copies are
// rewritten, and there is no origin/main). The mutation lane admits only root/package
// `src` tests, so this address makes it unreachable there by construction instead of
// by a classifier that has to recognise it — see KERNEL_TEST_FILE_RE in
// scripts/mutation/modules.ts.
'scripts/__tests__/test-file-size-ratchet.test.ts',
'scripts/__tests__/agent-setup-startup-contract.test.ts',
'scripts/__tests__/npm-skills-exclusion.test.ts',
'scripts/__tests__/simulator-skills-contract.test.ts',
Expand Down
Loading