diff --git a/src/util/file_reader.ts b/src/util/file_reader.ts index 2b011dbf..b8095eac 100644 --- a/src/util/file_reader.ts +++ b/src/util/file_reader.ts @@ -86,15 +86,6 @@ async function collectLocalPathBehaviors( ]; } - if (depth === 0) { - logger.warn( - `The provided path "${resolvedPath}" is not a .js file or directory.`, - {}, - "behavior", - ); - return []; - } - const behaviors: FileSources = []; if (stat.isDirectory()) { @@ -103,6 +94,15 @@ async function collectLocalPathBehaviors( const newBehaviors = await collectLocalPathBehaviors(file, depth + 1); behaviors.push(...newBehaviors); } + } else { + if (depth === 0) { + logger.warn( + `The provided path "${resolvedPath}" is not a .js file or directory.`, + {}, + "behavior", + ); + return []; + } } return behaviors;