Skip to content

Commit 99114e6

Browse files
committed
fix(agent-loader): ignore node_modules and hidden folders in agent discovery and fix integration test timeouts
1 parent d977769 commit 99114e6

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

dev/src/utils/agent_loader.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,12 @@ export class AgentLoader {
492492
}
493493

494494
if (fileOrDir.isDirectory) {
495+
if (
496+
fileOrDir.name === 'node_modules' ||
497+
fileOrDir.name.startsWith('.')
498+
) {
499+
return;
500+
}
495501
return this.loadAgentFromDirectory(fileOrDir);
496502
}
497503
}),

tests/integration/agent_loader/agent_dirname_test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {sendInput} from '../test_case_utils.js';
1313

1414
const execAsync = promisify(exec);
1515
const dirname = process.cwd();
16-
const TEST_EXECUTION_TIMEOUT = 40000;
16+
const TEST_EXECUTION_TIMEOUT = 60000;
17+
const HOOK_TIMEOUT = 120000;
1718

1819
describe.each(['__dirname', '__filename', 'import_meta_url'])(
1920
'Agent with %s',
@@ -26,7 +27,7 @@ describe.each(['__dirname', '__filename', 'import_meta_url'])(
2627

2728
beforeAll(async () => {
2829
await execAsync('npm install', {cwd: projectPath});
29-
}, TEST_EXECUTION_TIMEOUT);
30+
}, HOOK_TIMEOUT);
3031

3132
it(
3233
'should run agent and load params from file nearby via package.json script',
@@ -56,6 +57,6 @@ describe.each(['__dirname', '__filename', 'import_meta_url'])(
5657
await fs
5758
.unlink(path.join(projectPath, 'package-lock.json'))
5859
.catch(() => {});
59-
}, TEST_EXECUTION_TIMEOUT);
60+
}, HOOK_TIMEOUT);
6061
},
6162
);

tests/integration/app_loader/app_loader_test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import {sendInput} from '../test_case_utils.js';
1515

1616
const execAsync = promisify(exec);
1717
const dirname = process.cwd();
18-
const TEST_EXECUTION_TIMEOUT = 40000;
18+
const TEST_EXECUTION_TIMEOUT = 60000;
19+
const HOOK_TIMEOUT = 120000;
1920

2021
describe('App loader CLI integration', () => {
2122
describe.each(['app_ts', 'app_js', 'app_default'])(
@@ -29,7 +30,7 @@ describe('App loader CLI integration', () => {
2930

3031
beforeAll(async () => {
3132
await execAsync('npm install', {cwd: projectPath});
32-
}, TEST_EXECUTION_TIMEOUT);
33+
}, HOOK_TIMEOUT);
3334

3435
it(
3536
'should run app via package.json start script and get responses',
@@ -62,7 +63,7 @@ describe('App loader CLI integration', () => {
6263
await fs
6364
.unlink(path.join(projectPath, 'package-lock.json'))
6465
.catch(() => {});
65-
}, TEST_EXECUTION_TIMEOUT);
66+
}, HOOK_TIMEOUT);
6667
},
6768
);
6869
});
@@ -77,7 +78,8 @@ describe('AgentLoader discovery and loading integration', () => {
7778
beforeAll(async () => {
7879
await execAsync('npm install', {cwd: projectPath});
7980
loader = new AgentLoader(projectPath);
80-
}, TEST_EXECUTION_TIMEOUT);
81+
await loader.preloadAgents();
82+
}, HOOK_TIMEOUT);
8183

8284
it(
8385
'should discover apps vs agents across directories and standalone files',
@@ -138,5 +140,5 @@ describe('AgentLoader discovery and loading integration', () => {
138140
await fs
139141
.unlink(path.join(projectPath, 'package-lock.json'))
140142
.catch(() => {});
141-
}, TEST_EXECUTION_TIMEOUT);
143+
}, HOOK_TIMEOUT);
142144
});

0 commit comments

Comments
 (0)