Files
pbakaus_impeccable/tests/lib/detector-bundle.test.js
T
Abdul WahabandCursor 6d973cdea6 Fix: vendor static-HTML parsers so skill installs detect fully (#434)
Skill and plugin copies of the detector had no htmlparser2/css-select/css-tree/domutils, so HTML scans silently fell back to regex and exited 0. Bundle those parsers into the engine tree and exit 1 if the fallback still fires.

AI assistance: Cursor Grok 4.6 implemented this change.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-01 15:03:10 +05:00

29 lines
1.2 KiB
JavaScript

import { describe, expect, test } from 'bun:test';
import fs from 'fs';
import path from 'path';
import { readSourceFiles } from '../../scripts/lib/utils.js';
const ROOT = process.cwd();
describe('skill detector bundle', () => {
test('adds the detector wrapper and engine files to skill scripts', () => {
const { skills } = readSourceFiles(ROOT);
const skill = skills.find(s => s.name === 'impeccable');
const scriptNames = new Set(skill.scripts.map(s => s.name));
expect(scriptNames.has('detect.mjs')).toBe(true);
expect(scriptNames.has('detector/detect-antipatterns.mjs')).toBe(true);
expect(scriptNames.has('detector/detect-antipatterns-browser.js')).toBe(true);
expect(scriptNames.has('detector/cli/main.mjs')).toBe(true);
expect(scriptNames.has('detector/engines/static-html/detect-html.mjs')).toBe(true);
expect(scriptNames.has('detector/vendor/static-html-parsers.mjs')).toBe(true);
});
test('critique references the bundled detector command', () => {
const critique = fs.readFileSync(path.join(ROOT, 'skill/reference/critique.md'), 'utf-8');
expect(critique).toContain('node {{scripts_path}}/detect.mjs --json [target]');
expect(critique).not.toContain('npx impeccable detect');
});
});