Extract nullreporter

master
Frédéric Matte 2022-12-05 16:54:02 -05:00
parent 7bde58b5ed
commit b8ee7685fc
2 changed files with 12 additions and 9 deletions

View File

@ -1,11 +1,4 @@
const noreporter = { import { nullreporter } from './reporter/nullreporter.js'
start: (title) => { },
before: () => { },
success: (test) => { },
fail: (test, e) => { },
after: () => { },
end: (stats) => { },
}
const metaltest = (title) => { const metaltest = (title) => {
const suite = [] const suite = []
@ -27,7 +20,7 @@ const metaltest = (title) => {
runner.after = (fn) => { after.push(fn) } runner.after = (fn) => { after.push(fn) }
runner.run = async (...reporters) => { runner.run = async (...reporters) => {
const rs = reporters.map(r => Object.assign({}, noreporter, r)) const rs = reporters.map(r => Object.assign({}, nullreporter, r))
rs.forEach(r => r.start(title)) rs.forEach(r => r.start(title))
rs.forEach(r => r.before()) rs.forEach(r => r.before())

10
reporter/nullreporter.js Normal file
View File

@ -0,0 +1,10 @@
const nullreporter = {
start: (title) => { },
before: () => { },
success: (test) => { },
fail: (test, e) => { },
after: () => { },
end: (stats) => { },
}
export { nullreporter }