Open
Description
The change is pretty small and useful.
The use case is that I have a runner that uses cosmiconfig
to get some configuration, which also can be an array, so I basically return something like
Promise.all(
configs.map((cfg) => {
/* runner thing */
})
)
Currently, we need to return an object only, something like
const results = await Promise.all(
configs.map((cfg) => {
/* runner thing */
})
)
return results[0];
But this way it won't show/report in the terminal all the test results.
The only change needed is this:
create-jest-runner/lib/createJestRunner.js
Lines 142 to 148 in e17075b
to something like
const runAllTests = Promise.all(
tests.map(test =>
runTestInWorker(test)
.then(testResult => {
if (Array.isArray(testResult)) {
testResult.forEach(result =>
result.errorMessage && result.stats.failures > 0
? onError(new Error(result.errorMessage), test)
: onResult(test, result),
);
return;
}
onResult(test, testResult);
})
.catch(err => onError(err, test)),
),
);
Tested. It is working and shows all the tests.
$ jest -c jest.build.config.js
PASS build @tunnckocore/utils/dist/main/index.js
PASS build @tunnckocore/utils/dist/module/index.js
PASS build @tunnckocore/execa/dist/main/index.js
PASS build @tunnckocore/execa/dist/module/index.js
previously was showing only
PASS build @tunnckocore/utils/dist/main/index.js
PASS build @tunnckocore/execa/dist/main/index.js
Metadata
Metadata
Assignees
Labels
No labels