mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-11 21:57:14 +03:00
* Fix detector URL and advisory handling Recover joined URL arguments without splitting local paths, derive advisory behavior from registry severity across consumers, inspect readable linked CSS in URL scans, and report only the dominant primary font. AI assistance disclosure: Implemented and verified with Codex under maintainer direction. * Filter linked CSS to rendered selectors Flatten linked stylesheet grouping rules and collect only selector rules that target the live DOM, preventing unused grouped and selector-less patterns from leaking into URL findings. AI assistance disclosure: Implemented and verified with Codex under maintainer direction. * Fix detector review edge cases AI assistance disclosure: Codex implemented and verified these fixes under maintainer direction. * Preserve unresolved linked CSS selectors AI assistance disclosure: Codex implemented and verified this fix under maintainer direction. * Fix linked CSS selector filtering Resolve pseudo-element selectors to live hosts, reject unresolvable linked CSS findings, and make the regression assertions independent. Also ignore comment delimiters when recovering CSS rule selectors. AI assistance disclosure: This commit was prepared with Codex under maintainer direction. * Skip unresolved container query CSS Exclude linked container-query groups when their current applicability cannot be resolved, with a browser regression proving inactive styles do not leak. AI assistance disclosure: This commit was prepared with Codex under maintainer direction. * Detect active container query CSS Use a temporary custom-property probe so the browser decides whether a nested style rule actually applies in the current container layout. AI assistance disclosure: Codex helped implement and test this fix under maintainer direction. * Filter inactive linked CSS states Keep valid empty pseudo-class matches authoritative and omit selector-less linked at-rules that cannot be tied to rendered nodes. AI assistance disclosure: Codex helped implement and test this fix under maintainer direction. * Parse pseudo-elements without rewriting literals Preserve quoted attribute values and escaped identifiers while resolving real pseudo-elements to live hosts. AI assistance disclosure: Codex helped implement and test this fix under maintainer direction. * Restore live linked keyframes AI assistance disclosure: Codex helped implement and verify this fix under maintainer direction. * Handle grouped linked keyframes AI assistance disclosure: Codex helped implement and verify this fix under maintainer direction. * Respect keyframe definition order AI assistance disclosure: Codex helped implement and verify this fix under maintainer direction. * Resolve effective linked keyframes AI assistance disclosure: Codex helped implement and verify this fix under maintainer direction. * Fix keyframe easing detection Serialize effective per-keyframe easing back into the linked stylesheet corpus so overshoot motion is detected. Add a browser regression with a neutral animation name.\n\nAI assistance disclosure: Codex helped implement and test this fix under maintainer direction.
68 lines
2.1 KiB
JavaScript
68 lines
2.1 KiB
JavaScript
import { after, describe, it } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs';
|
|
import os from 'node:os';
|
|
import path from 'node:path';
|
|
import { spawnSync } from 'node:child_process';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
const cli = path.join(root, 'cli', 'bin', 'cli.js');
|
|
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'impeccable-stdin-dispatch-'));
|
|
|
|
function detectStdinFile(filePath, expectedStatus = 2) {
|
|
const result = spawnSync(
|
|
process.execPath,
|
|
[cli, 'detect', '--json', '--no-config', '--no-design-system'],
|
|
{
|
|
input: JSON.stringify({ tool_input: { file_path: filePath } }),
|
|
encoding: 'utf8',
|
|
},
|
|
);
|
|
assert.equal(result.status, expectedStatus, result.stderr);
|
|
return JSON.parse(result.stdout);
|
|
}
|
|
|
|
after(() => {
|
|
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
});
|
|
|
|
describe('detect CLI stdin file dispatch', () => {
|
|
it('uses the static HTML engine for an HTML tool-input path', () => {
|
|
const filePath = path.join(tempDir, 'page.html');
|
|
fs.writeFileSync(
|
|
path.join(tempDir, 'page.css'),
|
|
'.notice { border-left: 4px solid blue; border-radius: 12px; }',
|
|
);
|
|
fs.writeFileSync(filePath, `
|
|
<!doctype html>
|
|
<link rel="stylesheet" href="./page.css">
|
|
<div class="notice">Notice</div>
|
|
`);
|
|
|
|
const findings = detectStdinFile(filePath);
|
|
assert.ok(findings.some(
|
|
(item) => item.file === filePath && item.antipattern === 'side-tab',
|
|
));
|
|
});
|
|
|
|
it('uses the text engine for a non-HTML tool-input path', () => {
|
|
const filePath = path.join(tempDir, 'styles.css');
|
|
fs.writeFileSync(filePath, `
|
|
.grid {
|
|
background-image:
|
|
linear-gradient(#eee 1px, transparent 1px),
|
|
linear-gradient(90deg, #eee 1px, transparent 1px);
|
|
background-size: 24px 24px;
|
|
}
|
|
`);
|
|
|
|
const findings = detectStdinFile(filePath, 0);
|
|
assert.ok(findings.some(
|
|
(item) => item.file === filePath
|
|
&& item.antipattern === 'codex-grid-background'
|
|
&& item.advisory === true,
|
|
));
|
|
});
|
|
});
|