fix: persist repaired exclusions
This commit is contained in:
@@ -60,6 +60,28 @@ describe('findings exclusions', () => {
|
||||
assert.ok(logs.some(line => line.includes('排除問題格式已修正為頂層陣列: source=exclusions -> array')));
|
||||
});
|
||||
|
||||
it('mirrors repaired exclusions into the workspace root when requested', () => {
|
||||
const repoRoot = path.join(workspace, 'repo');
|
||||
const mirrorRoot = path.join(workspace, 'workspace');
|
||||
const repoFullPath = path.join(repoRoot, EXCLUSIONS_PATH);
|
||||
const mirrorFullPath = path.join(mirrorRoot, EXCLUSIONS_PATH);
|
||||
fs.mkdirSync(path.dirname(repoFullPath), { recursive: true });
|
||||
fs.mkdirSync(path.dirname(mirrorFullPath), { recursive: true });
|
||||
fs.writeFileSync(repoFullPath, JSON.stringify({
|
||||
exclusions: [
|
||||
{ location: 'README.md:12', suggestion: 'keep' },
|
||||
],
|
||||
}, null, 2));
|
||||
|
||||
const exclusions = loadExclusions(repoRoot, null, mirrorRoot);
|
||||
const mirror = JSON.parse(fs.readFileSync(mirrorFullPath, 'utf8'));
|
||||
|
||||
assert.equal(exclusions.length, 1);
|
||||
assert.ok(Array.isArray(mirror));
|
||||
assert.equal(mirror[0].location, 'README.md:12');
|
||||
assert.equal(mirror[0].suggestion, 'keep');
|
||||
});
|
||||
|
||||
it('applies exclusions loaded from wrapper format', () => {
|
||||
const findings = [
|
||||
{ location: 'entrypoint.sh:180', role: 'Maya', suggestion: 'keep' },
|
||||
|
||||
Reference in New Issue
Block a user