({
jestConfig,
tsJestConfig,
logger, // don't change this key name, otherwise mock logging won't work
resolve = defaultResolve,
...others
}: {
jestConfig?: Partial<Config.ProjectConfig>
tsJestConfig?: TsJestTransformerOptions
logger?: Logger
resolve?: ((path: string) => string) | null
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any
} = {})
| 40 | export const defaultResolve = (path: string): string => `resolved:${path}` |
| 41 | |
| 42 | export function createConfigSet({ |
| 43 | jestConfig, |
| 44 | tsJestConfig, |
| 45 | logger, // don't change this key name, otherwise mock logging won't work |
| 46 | resolve = defaultResolve, |
| 47 | ...others |
| 48 | }: { |
| 49 | jestConfig?: Partial<Config.ProjectConfig> |
| 50 | tsJestConfig?: TsJestTransformerOptions |
| 51 | logger?: Logger |
| 52 | resolve?: ((path: string) => string) | null |
| 53 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 54 | [key: string]: any |
| 55 | } = {}): ConfigSet { |
| 56 | const jestCfg = getJestConfig(jestConfig, tsJestConfig) |
| 57 | const cs = new ConfigSet( |
| 58 | { |
| 59 | ...jestCfg, |
| 60 | testMatch: jestConfig?.testMatch ? [...jestConfig.testMatch, ...defaultTestMatch] : defaultTestMatch, |
| 61 | testRegex: jestConfig?.testRegex ? [...jestConfig.testRegex, ...defaultTestRegex] : defaultTestRegex, |
| 62 | extensionsToTreatAsEsm: jestCfg.extensionsToTreatAsEsm ?? [], |
| 63 | }, |
| 64 | logger, |
| 65 | ) |
| 66 | if (resolve) { |
| 67 | cs.resolvePath = resolve |
| 68 | } |
| 69 | Object.keys(others).forEach((key) => { |
| 70 | Object.defineProperty(cs, key, { value: others[key] }) |
| 71 | }) |
| 72 | |
| 73 | return cs |
| 74 | } |
| 75 | |
| 76 | // not really unit-testing here, but it's hard to mock all those values :-D |
| 77 | export function makeCompiler( |
searching dependent graphs…