( dir: string, args: Array<string> = [], options?: RunJestOptions, )
| 283 | |
| 284 | // return type matches output of logDebugMessages |
| 285 | export 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 | } |
no test coverage detected