Files
pnpm/jest.config.js
Brandon Cheng c7e1b6fae8 chore: configure TypeScript project references for tests (#8128)
* refactor: store link values before converting to references

* fix: use .sort() without localeCompare

https://github.com/pnpm/pnpm/pull/8128#discussion_r1614031566

> Nit, but you probably just want to call sort without a comparison
> function; these are already strings and locale compare is not a good
> comparison for anything but human readable strings since it will
> differ on different people's machines based on their language setting.
> I've hit this too many times before for code gen.

* feat: configure meta-updater to write test/tsconfig.json files

* fix: relative imports for __typings__

* chore: `pnpm run meta-updater`

* fix: explicitly use test/tsconfig.json for ts-jest
2024-05-31 12:48:13 +02:00

30 lines
1016 B
JavaScript

const path = require("path")
const config = {
preset: "ts-jest",
transform: {
'^.+\\.tsx?$': ['ts-jest', {
// For most projects, the tsconfig.json and test/tsconfig.json are almost
// exactly the same. But it's more correct to point to test/tsconfig.json
// to prevent surprises in the future.
tsconfig: 'test/tsconfig.json'
}]
},
testMatch: ["**/test/**/*.[jt]s?(x)", "**/src/**/*.test.ts"],
testEnvironment: "node",
collectCoverage: true,
coveragePathIgnorePatterns: ["/node_modules/"],
testPathIgnorePatterns: ["/fixtures/", "/__fixtures__/", "<rootDir>/test/utils/.+"],
testTimeout: 4 * 60 * 1000, // 4 minutes
setupFilesAfterEnv: [path.join(__dirname, "jest.setup.js")],
maxWorkers: "50%",
}
if (process.env.PNPM_SCRIPT_SRC_DIR) {
const pathAsArr = process.env.PNPM_SCRIPT_SRC_DIR.split(path.sep)
const packageName = pathAsArr[pathAsArr.length - 1]
config.cacheDirectory = path.join(__dirname, ".jest-cache", packageName)
}
module.exports = config