mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-09-30 12:39:42 +02:00
fix(build): merge-time fixes for #500
- pre-push hook: skip with a notice when npm is not on PATH (GUI git clients and IDEs often run hooks with a minimal PATH), instead of blocking every push on "npm: not found"; real-push test with a stripped PATH - test/git-hooks.test.ts: pin GIT_CONFIG_NOSYSTEM=1 and GIT_CONFIG_GLOBAL=/dev/null around the resolveGitHooksDir tests, so an exported global or a system core.hooksPath no longer fails them - watch tsconfig.json, .prettierignore and .editorconfig too: typecheck and format:check read them - check:browser-excludes: fail loudly when the vitest list output and the walked test/**/*.test.ts tree share no path (format drift would otherwise pass vacuously) - Reword the PRE_PUSH_MARKER comment: bumping its version would make every installed v1 hook read as foreign and never refresh again. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,9 @@ import { join, resolve } from 'node:path';
|
||||
import {
|
||||
findBrowserTests,
|
||||
findLeaks,
|
||||
findTestFiles,
|
||||
importsBrowserDriver,
|
||||
listingMatchesTree,
|
||||
parseVitestFileList,
|
||||
} from '../scripts/check-browser-test-excludes.mjs';
|
||||
import { BROWSER_TEST_GLOBS } from '../config/test-suites';
|
||||
@@ -68,6 +70,15 @@ describe('findBrowserTests (fixture tree)', () => {
|
||||
'test/new.browser.test.ts',
|
||||
]);
|
||||
});
|
||||
|
||||
it('lists every test file, browser-driven or not, in the same form', () => {
|
||||
expect(findTestFiles(root)).toEqual([
|
||||
'test/legacy-name.test.ts',
|
||||
'test/nested/deep.test.ts',
|
||||
'test/new.browser.test.ts',
|
||||
'test/unit.test.ts',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseVitestFileList + findLeaks', () => {
|
||||
@@ -83,6 +94,19 @@ describe('parseVitestFileList + findLeaks', () => {
|
||||
]);
|
||||
expect(findLeaks(['test/new.browser.test.ts'], ci)).toEqual([]);
|
||||
});
|
||||
|
||||
it('flags a non-empty listing whose paths never match the tree instead of passing vacuously', () => {
|
||||
const tree = ['test/legacy-name.test.ts', 'test/unit.test.ts'];
|
||||
// e.g. a vitest upgrade that starts printing absolute paths: nothing leaks, but only
|
||||
// because nothing matches, so the checker must refuse rather than report success.
|
||||
const drifted = parseVitestFileList('/repo/test/legacy-name.test.ts\n/repo/test/unit.test.ts\n');
|
||||
expect(drifted.size).toBe(2);
|
||||
expect(findLeaks(['test/legacy-name.test.ts'], drifted)).toEqual([]);
|
||||
expect(listingMatchesTree(drifted, tree)).toBe(false);
|
||||
|
||||
const healthy = parseVitestFileList('test/legacy-name.test.ts\ntest/unit.test.ts\n');
|
||||
expect(listingMatchesTree(healthy, tree)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('against this repository', () => {
|
||||
|
||||
Reference in New Issue
Block a user