Skip to content

Commit

Permalink
chore: add expect to EXTERNAL_IMPORT_ALLOWLIST in utils/check_deps.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mrienstra committed Sep 5, 2021
1 parent da15ad7 commit 7e26ebb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions utils/check_deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,20 @@ async function checkDeps() {


function allowExternalImport(from, importPath, importName) {
const EXTERNAL_IMPORT_ALLOWLIST = ['electron'];
const EXTERNAL_IMPORT_ALLOWLIST = [
'electron',
'expect/build/types',
'expect/build/jasmineUtils',
'expect/build/print',
'expect/build/matchers'
];
// Only external imports are relevant. Files in src/web are bundled via webpack.
if (importName.startsWith('.') || importPath.startsWith(path.join(src, 'web')))
return true;
if (EXTERNAL_IMPORT_ALLOWLIST.includes(importName))
return true;
try {
const resolvedImport = require.resolve(importName)
const resolvedImport = require.resolve(importName);
const resolvedImportRelativeToNodeModules = path.relative(path.join(root, 'node_modules'), resolvedImport);
// Filter out internal Node.js modules
if (!resolvedImportRelativeToNodeModules.startsWith(importName))
Expand All @@ -118,7 +124,7 @@ async function checkDeps() {
return false;
} catch (error) {
if (error.code !== 'MODULE_NOT_FOUND')
throw error
throw error;
}
}
}
Expand Down

0 comments on commit 7e26ebb

Please sign in to comment.