mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-21 02:26:31 +03:00
Fix: fail CI when the vendored HTML parser bundle is stale.
Greptile caught that editing the bundle entry did not refresh the committed vendor file, and neither build nor the detector suite would notice. --check compares a fresh rebuild, bun run build runs that check, and the detector suite now triggers on the entry. AI-assisted. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { readSourceFiles } from '../../scripts/lib/utils.js';
|
||||
@@ -19,6 +20,31 @@ describe('skill detector bundle', () => {
|
||||
expect(scriptNames.has('detector/vendor/static-html-parsers.mjs')).toBe(true);
|
||||
});
|
||||
|
||||
test('static HTML parser vendor bundle matches a fresh rebuild', () => {
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[path.join(ROOT, 'scripts/build-static-html-parsers.js'), '--check'],
|
||||
{ cwd: ROOT, encoding: 'utf8' },
|
||||
);
|
||||
expect(result.status).toBe(0);
|
||||
});
|
||||
|
||||
test('static HTML parser --check fails when the vendor bundle is stale', () => {
|
||||
const vendor = path.join(ROOT, 'cli/engine/vendor/static-html-parsers.mjs');
|
||||
const original = fs.readFileSync(vendor, 'utf8');
|
||||
try {
|
||||
fs.writeFileSync(vendor, original.replace('htmlparser2', 'htmlparser2-stale'));
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[path.join(ROOT, 'scripts/build-static-html-parsers.js'), '--check'],
|
||||
{ cwd: ROOT, encoding: 'utf8' },
|
||||
);
|
||||
expect(result.status).toBe(1);
|
||||
} finally {
|
||||
fs.writeFileSync(vendor, original);
|
||||
}
|
||||
});
|
||||
|
||||
test('critique references the bundled detector command', () => {
|
||||
const critique = fs.readFileSync(path.join(ROOT, 'skill/reference/critique.md'), 'utf-8');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user