diff --git a/scripts/framework-components/ProhibitedTermsScanner.js b/scripts/framework-components/ProhibitedTermsScanner.js index ffd0e1bf..a62ff0df 100644 --- a/scripts/framework-components/ProhibitedTermsScanner.js +++ b/scripts/framework-components/ProhibitedTermsScanner.js @@ -15,7 +15,7 @@ const fs = require('fs').promises; const path = require('path'); -const { glob } = require('glob'); +const glob = require('glob'); const { execSync } = require('child_process'); class ProhibitedTermsScanner { @@ -259,17 +259,14 @@ class ProhibitedTermsScanner { const files = []; for (const pattern of this.includePatterns) { try { - const matches = await glob(pattern, { + const matches = glob.sync(pattern, { ignore: this.excludePatterns, nodir: true, cwd: this.options.basePath }); - // glob returns an array, so we can spread it - if (Array.isArray(matches)) { - // Prepend base path to make absolute paths - const absolutePaths = matches.map(f => path.join(this.options.basePath, f)); - files.push(...absolutePaths); - } + // Prepend base path to make absolute paths + const absolutePaths = matches.map(f => path.join(this.options.basePath, f)); + files.push(...absolutePaths); } catch (err) { // Ignore glob errors (e.g., pattern doesn't match anything) } diff --git a/tests/unit/BlogCuration.service.test.js b/tests/unit/BlogCuration.service.test.js index 8afd17f6..f3d17842 100644 --- a/tests/unit/BlogCuration.service.test.js +++ b/tests/unit/BlogCuration.service.test.js @@ -13,6 +13,10 @@ jest.mock('../../src/services/BoundaryEnforcer.service', () => ({ enforce: jest.fn() })); +jest.mock('../../src/models/Document.model', () => ({ + list: jest.fn().mockResolvedValue([]) +})); + const BlogCuration = require('../../src/services/BlogCuration.service'); const ClaudeAPI = require('../../src/services/ClaudeAPI.service'); const BoundaryEnforcer = require('../../src/services/BoundaryEnforcer.service');