feat(reporters): add built-in "json" reporter and rename "default" to "pretty"

This commit is contained in:
Joakim Carlstein 2024-02-06 09:15:16 +01:00 committed by Joakim Carlstein
parent 4e8ac5294d
commit 18382ce961
11 changed files with 102 additions and 16 deletions

View file

@ -0,0 +1,14 @@
import { type Config } from '../types.js';
import * as reporters from './index.js';
export const getStandardReporter = (reporter?: Config['reporter']) => {
if (!reporter) {
return reporters.pretty;
}
if (typeof reporter === 'string' && reporter in reporters) {
return reporters[reporter as keyof typeof reporters];
}
return; // eslint-disable-line no-useless-return
};