Skip to content

Commit

Permalink
Rename result -> results to align with runCLI api
Browse files Browse the repository at this point in the history
  • Loading branch information
nicojs committed Apr 22, 2023
1 parent 0f8f6f2 commit 1935947
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions e2e/run-programmatically/core.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ const runConfig = Object.freeze({
collectCoverage: false,
watch: false,
});
const {result} = await jest.runCore(runConfig, configs);
console.log(`runCore success, ${result.numPassedTests} passed tests.`);
const {results} = await jest.runCore(runConfig, configs);
console.log(`runCore success, ${results.numPassedTests} passed tests.`);
2 changes: 1 addition & 1 deletion packages/jest-core/src/__tests__/runCore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe(runCore, () => {
makeProjectConfig(),
]);
expect(jest.mocked(runJest)).toHaveBeenCalled();
expect(actualResult).toEqual({result: {results: {success: true}}});
expect(actualResult).toEqual({results: {results: {success: true}}});
});

it('should provide stderr as output stream when useStderr is true', async () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/jest-core/src/runCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ const {print: preRunMessagePrint} = preRunMessage;
* import {runCore, readConfigs} from 'jest';
*
* const {globalConfig, configs} = await readConfigs(process.argv, [process.cwd()]);
* const results = await runCore(globalConfig, configs);
* const {results} = await runCore(globalConfig, configs);
* console.log(results);
*/
export async function runCore(
globalConfig: Config.GlobalConfig,
projectConfigs: Array<Config.ProjectConfig>,
): Promise<RunCoreResult> {
const outputStream = globalConfig.useStderr ? process.stderr : process.stdout;
const result = await _run(globalConfig, projectConfigs, false, outputStream);
return {result};
const results = await _run(globalConfig, projectConfigs, false, outputStream);
return {results};
}

const buildContextsAndHasteMaps = async (
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ export type OnCompleteCallback = (
* The result of running runCore.
*/
export type RunCoreResult = {
result: AggregatedResult;
results: AggregatedResult;
};

0 comments on commit 1935947

Please sign in to comment.