MCPcopy
hub / github.com/jestjs/jest / getConfig

Function getConfig

e2e/runJest.ts:285–313  ·  view source on GitHub ↗
(
  dir: string,
  args: Array<string> = [],
  options?: RunJestOptions,
)

Source from the content-addressed store, hash-verified

283
284// return type matches output of logDebugMessages
285export function getConfig(
286 dir: string,
287 args: Array<string> = [],
288 options?: RunJestOptions,
289): {
290 globalConfig: Config.GlobalConfig;
291 configs: Array<Config.ProjectConfig>;
292 version: string;
293} {
294 const {exitCode, stdout, stderr} = runJest(
295 dir,
296 [...args, '--show-config'],
297 options,
298 );
299
300 try {
301 expect(exitCode).toBe(0);
302 } catch (error) {
303 console.error('Exit code is not 0', {stderr, stdout});
304 throw error;
305 }
306
307 const {testPathPatterns, ...globalConfig} = JSON.parse(stdout);
308
309 return {
310 ...globalConfig,
311 testPathPatterns: new TestPathPatterns(testPathPatterns),
312 };
313}

Calls 4

expectFunction · 0.85
toBeMethod · 0.80
runJestFunction · 0.70
errorMethod · 0.45

Tested by

no test coverage detected