mirror of
https://github.com/pnpm/pnpm.git
synced 2026-07-25 15:07:06 -04:00
* test: use `import type` in more places Several tests are failing because a module isn't being mocked. This is due to the mocked module being imported before the mock being set up. Switching to `import type` should elide the import fully. * build: replace ts-jest with simple transformer * chore: remove `ts-jest` * chore: remove babel dependencies from root project * ci: use Node.js 22.13.0 (instead of 22.12.0) Node.js 22.13.0 introduces the `stripTypeScriptTypes` function * fix: copilot feedback
35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
JavaScript
import path from 'path'
|
|
|
|
const config = {
|
|
resolver: path.join(import.meta.dirname, 'node_modules/ts-jest-resolver'),
|
|
extensionsToTreatAsEsm: ['.ts'],
|
|
transform: {
|
|
'^.+\\.tsx?$': path.join(import.meta.dirname, 'jest.transform.js'),
|
|
},
|
|
testMatch: ["**/test/**/*.[jt]s?(x)", "**/src/**/*.test.ts"],
|
|
testEnvironment: "node",
|
|
collectCoverage: true,
|
|
coveragePathIgnorePatterns: ["/node_modules/"],
|
|
testPathIgnorePatterns: ["/fixtures/", "/__fixtures__/", "<rootDir>/test/utils/.+"],
|
|
modulePathIgnorePatterns: ['\/__fixtures__\/.*'],
|
|
testTimeout: 4 * 60 * 1000, // 4 minutes
|
|
setupFilesAfterEnv: [path.join(import.meta.dirname, "setupFilesAfterEnv.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(import.meta.dirname, ".jest-cache", packageName)
|
|
}
|
|
|
|
// We are running test script from pnpm command, this seems to confuse tests
|
|
// Clean up env from pnpm variables so that nested pnpm runs won't get affected on config read
|
|
for (const key of Object.keys(process.env)) {
|
|
if (/^p?npm_(config|package|lifecycle|node|command|execpath)(_|$)/ui.test(key)) {
|
|
delete process.env[key]
|
|
}
|
|
}
|
|
|
|
export default config
|