chore(skills): improve watcher event observability
This commit is contained in:
@@ -11,6 +11,7 @@ describe('initSkills watcher wiring', () => {
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
vi.restoreAllMocks();
|
||||
for (const root of roots.splice(0)) {
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
@@ -64,6 +65,7 @@ describe('initSkills watcher wiring', () => {
|
||||
|
||||
it('applies targeted add/update changes for a mapped skill path', () => {
|
||||
vi.useFakeTimers();
|
||||
const consoleLog = vi.spyOn(console, 'log').mockImplementation(() => {});
|
||||
const root = mkdtempSync(join(tmpdir(), 'flynn-services-'));
|
||||
roots.push(root);
|
||||
const managedDir = join(root, 'skills');
|
||||
@@ -91,6 +93,7 @@ describe('initSkills watcher wiring', () => {
|
||||
result.skillsWatcher?.notifyPathChanged(join(managedDir, 'beta', 'SKILL.md'));
|
||||
vi.advanceTimersByTime(20);
|
||||
expect(result.skillRegistry.get('beta')?.instructions).toContain('Updated instructions.');
|
||||
expect(consoleLog.mock.calls.some((call) => call[0]?.includes('mode=targeted'))).toBe(true);
|
||||
|
||||
result.skillsWatcher?.stop();
|
||||
});
|
||||
@@ -128,6 +131,7 @@ describe('initSkills watcher wiring', () => {
|
||||
|
||||
it('falls back to full reload for ambiguous paths', () => {
|
||||
vi.useFakeTimers();
|
||||
const consoleLog = vi.spyOn(console, 'log').mockImplementation(() => {});
|
||||
const root = mkdtempSync(join(tmpdir(), 'flynn-services-'));
|
||||
roots.push(root);
|
||||
const managedDir = join(root, 'skills');
|
||||
@@ -151,6 +155,7 @@ describe('initSkills watcher wiring', () => {
|
||||
vi.advanceTimersByTime(20);
|
||||
|
||||
expect(result.skillRegistry.get('beta')).toBeDefined();
|
||||
expect(consoleLog.mock.calls.some((call) => call[0]?.includes('fallback triggered (reason=unmapped_path'))).toBe(true);
|
||||
result.skillsWatcher?.stop();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user