Show totalError
parent
1b53b9854b
commit
d9786a78d0
|
@ -1,11 +1,12 @@
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import { walkDir } from './walkDir.js'
|
import { walkDir } from './walkDir.js'
|
||||||
import { summaryreporter, errorreporter, totalreporter } from 'metaltest'
|
import { summaryreporter, totalreporter, totalerrorreporter } from 'metaltest'
|
||||||
|
|
||||||
const suite = async (folder = '.') => {
|
const suite = async (folder = '.') => {
|
||||||
const fileIgnored = []
|
const fileIgnored = []
|
||||||
|
|
||||||
const total = totalreporter()
|
const total = totalreporter()
|
||||||
|
const error = totalerrorreporter()
|
||||||
|
|
||||||
for await (const file of walkDir(folder, ['node_modules', '.git'])) {
|
for await (const file of walkDir(folder, ['node_modules', '.git'])) {
|
||||||
if (!file.endsWith('.test.js')) continue
|
if (!file.endsWith('.test.js')) continue
|
||||||
|
@ -18,13 +19,14 @@ const suite = async (folder = '.') => {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
await test.run(summaryreporter(), errorreporter(), total)
|
await test.run(summaryreporter(), error, total)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const file of fileIgnored) {
|
for (const file of fileIgnored) {
|
||||||
console.log(`The file ${file} doesn't export the metaltest object`)
|
console.log(`The file ${file} doesn't export the metaltest object`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error.msg()
|
||||||
console.log(total.msg())
|
console.log(total.msg())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,5 @@ export { summaryreporter } from './summaryreporter.js'
|
||||||
export { linereporter } from './linereporter.js'
|
export { linereporter } from './linereporter.js'
|
||||||
export { totalreporter } from './totalreporter.js'
|
export { totalreporter } from './totalreporter.js'
|
||||||
export { errorreporter } from './errorreporter.js'
|
export { errorreporter } from './errorreporter.js'
|
||||||
|
export { totalerrorreporter } from './totalerrorreporter.js'
|
||||||
export { endreporter } from './endreporter.js'
|
export { endreporter } from './endreporter.js'
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { showError } from "./showError.js"
|
||||||
|
|
||||||
|
const totalerrorreporter = () => {
|
||||||
|
const testFails = []
|
||||||
|
|
||||||
|
const report = {
|
||||||
|
end: (stats) => testFails.push(...stats.testFail),
|
||||||
|
msg: () => {
|
||||||
|
showError(testFails)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return report
|
||||||
|
}
|
||||||
|
|
||||||
|
export { totalerrorreporter }
|
Loading…
Reference in New Issue