MCPcopy
hub / github.com/kulshekhar/ts-jest / makeCompiler

Function makeCompiler

src/__helpers__/fakers.ts:77–104  ·  view source on GitHub ↗
(
  {
    jestConfig,
    tsJestConfig,
    parentConfig,
  }: {
    jestConfig?: Partial<Config.ProjectConfig>
    tsJestConfig?: TsJestTransformerOptions
    parentConfig?: TsJestTransformerOptions
  } = {},
  jestCacheFS: StringMap = new Map<string, string>(),
)

Source from the content-addressed store, hash-verified

75
76// not really unit-testing here, but it's hard to mock all those values :-D
77export function makeCompiler(
78 {
79 jestConfig,
80 tsJestConfig,
81 parentConfig,
82 }: {
83 jestConfig?: Partial<Config.ProjectConfig>
84 tsJestConfig?: TsJestTransformerOptions
85 parentConfig?: TsJestTransformerOptions
86 } = {},
87 jestCacheFS: StringMap = new Map<string, string>(),
88): TsCompiler {
89 tsJestConfig = { ...tsJestConfig }
90 tsJestConfig.diagnostics = {
91 // eslint-disable-next-line @typescript-eslint/no-explicit-any
92 ...(tsJestConfig.diagnostics as any),
93 pretty: false,
94 }
95 jestConfig = {
96 ...jestConfig,
97 extensionsToTreatAsEsm: jestConfig?.extensionsToTreatAsEsm ?? [],
98 testMatch: jestConfig?.testMatch ? [...jestConfig.testMatch, ...defaultTestMatch] : defaultTestMatch,
99 testRegex: jestConfig?.testRegex ? [...jestConfig.testRegex, ...defaultTestRegex] : defaultTestRegex,
100 }
101 const cs = createConfigSet({ jestConfig, tsJestConfig, parentConfig, resolve: null })
102
103 return new TsCompiler(cs, jestCacheFS)
104}

Callers 3

hoist-jest.spec.tsFile · 0.90

Calls 1

createConfigSetFunction · 0.85

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…