From a71feba2512c7ddd513591acd223bcfe5f65c568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Matte?= Date: Fri, 11 Oct 2024 13:08:41 -0400 Subject: [PATCH] Extract the log function --- lib/log.js | 5 +++++ reporter/errorreporter.js | 3 +-- reporter/linereporter.js | 3 +-- reporter/summaryreporter.js | 3 +-- 4 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 lib/log.js diff --git a/lib/log.js b/lib/log.js new file mode 100644 index 0000000..6e8bcde --- /dev/null +++ b/lib/log.js @@ -0,0 +1,5 @@ +const log = (...args) => { + process.stdout.write(...args) +} + +export { log } \ No newline at end of file diff --git a/reporter/errorreporter.js b/reporter/errorreporter.js index 58e02fd..415b535 100644 --- a/reporter/errorreporter.js +++ b/reporter/errorreporter.js @@ -1,6 +1,5 @@ import chalk from 'chalk' - -const log = (...args) => process.stdout.write(...args) +import { log } from '../lib/log.js' const errorreporter = () => { const report = { diff --git a/reporter/linereporter.js b/reporter/linereporter.js index 13fcdfc..6895635 100644 --- a/reporter/linereporter.js +++ b/reporter/linereporter.js @@ -1,7 +1,6 @@ import chalk from 'chalk' import { stackParser } from '../lib/stackparser.js' - -const log = (...args) => console.log(...args) +import { log } from '../lib/log.js' const linereporter = () => { const lines = [] diff --git a/reporter/summaryreporter.js b/reporter/summaryreporter.js index 36fb160..260b55a 100644 --- a/reporter/summaryreporter.js +++ b/reporter/summaryreporter.js @@ -1,6 +1,5 @@ import chalk from 'chalk' - -const log = (...args) => process.stdout.write(...args) +import { log } from '../lib/log.js' const summaryreporter = () => {