From 1ea00f161609fc896733a352c932454358440d19 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 21 May 2022 19:29:26 +0100 Subject: [PATCH] Add chalk --- tests/helpers/run.js | 2 +- tests/runTests.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/helpers/run.js b/tests/helpers/run.js index 3cb7f52..05c9aec 100644 --- a/tests/helpers/run.js +++ b/tests/helpers/run.js @@ -22,7 +22,7 @@ const run = async (tests) => { } } catch (err) { // eslint-disable-next-line no-console - console.log(err); + console.error(err); process.exit(1); } }; diff --git a/tests/runTests.js b/tests/runTests.js index efc459c..2802bd8 100644 --- a/tests/runTests.js +++ b/tests/runTests.js @@ -1,6 +1,7 @@ /* eslint no-console: 0 */ // --> OFF const fs = require('fs'); +const chalk = require('chalk'); const childProcess = require('child_process'); const filenames = fs.readdirSync(`${process.cwd()}/Community`); @@ -13,15 +14,15 @@ const run = async () => { let shouldRunTest = true; if (!text.includes('// tdarrSkipTest') && !fs.existsSync(pluginTestpath)) { - console.log(`${filenames[i]} does not have a test but should do.`); + console.log(chalk.red(`${filenames[i]} does not have a test but should do.`)); process.exit(1); } else if (!text.includes('// tdarrSkipTest') && fs.existsSync(pluginTestpath)) { - console.log(`${filenames[i]} running test`); + console.log(chalk.white(`${filenames[i]} running test`)); } else if (text.includes('// tdarrSkipTest') && fs.existsSync(pluginTestpath)) { - console.log(`${filenames[i]} should have // tdarrSkipTest removed`); + console.log(chalk.red(`${filenames[i]} should have // tdarrSkipTest removed`)); process.exit(1); } else if (text.includes('// tdarrSkipTest') && !fs.existsSync(pluginTestpath)) { - console.log(`${filenames[i]} skipping tests`); + console.log(chalk.yellow(`${filenames[i]} skipping tests`)); shouldRunTest = false; } @@ -33,7 +34,7 @@ const run = async () => { console.log(err); } console.log(stdout); - console.log(stderr); + console.log(chalk.red(stderr)); }).on('exit', async (code) => { if (code !== 0) { await new Promise((resolve2) => setTimeout(resolve2, 1000));