diff --git a/.changeset/warm-olives-report.md b/.changeset/warm-olives-report.md new file mode 100644 index 0000000..46b445e --- /dev/null +++ b/.changeset/warm-olives-report.md @@ -0,0 +1,5 @@ +--- +"@zcloak/dev": patch +--- + +ignore pattern with monorepo packages diff --git a/packages/dev/config/jest.cjs b/packages/dev/config/jest.cjs index 32338a3..1e24842 100644 --- a/packages/dev/config/jest.cjs +++ b/packages/dev/config/jest.cjs @@ -1,17 +1,16 @@ // Copyright 2021-2023 zcloak authors & contributors // SPDX-License-Identifier: Apache-2.0 -const fs = require('fs'); +const path = require('path'); const { defaults } = require('jest-config'); +const { getPackagesSync } = require('@manypkg/get-packages'); + +const { packages } = getPackagesSync(process.cwd()); + module.exports = { moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'], - modulePathIgnorePatterns: ['/build'].concat( - fs - .readdirSync('packages') - .filter((p) => fs.statSync(`packages/${p}`).isDirectory()) - .map((p) => `/packages/${p}/build`) - ), + modulePathIgnorePatterns: packages.map((pkg) => path.join(pkg.dir, 'build')), // custom resolver to do TS-like imports resolver: require.resolve('./jest-resolver.cjs'), // See https://jestjs.io/docs/configuration#extraglobals-arraystring