From 2e5e6dcd2ff116a45b6a16e4decccceef24f209c Mon Sep 17 00:00:00 2001 From: Ivo Murrell Date: Fri, 28 Apr 2023 14:29:21 +0100 Subject: [PATCH] fix(mocha): don't insert empty argument if default config is used mocha was interpreting this extra empty arg as a file glob of "", and always logging a warning that the file glob didn't match any files to test. This fixes the noise. --- plugins/mocha/src/tasks/mocha.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/mocha/src/tasks/mocha.ts b/plugins/mocha/src/tasks/mocha.ts index 41cc72c84..ce2a6929b 100644 --- a/plugins/mocha/src/tasks/mocha.ts +++ b/plugins/mocha/src/tasks/mocha.ts @@ -12,7 +12,10 @@ export default class Mocha extends Task { async run(): Promise { const files = await promisify(glob)(this.options.files) - const args = ['--color', this.options.configPath ? `--config=${this.options.configPath}` : '', ...files] + const args = ['--color', ...files] + if (this.options.configPath) { + args.unshift(`--config=${this.options.configPath}`) + } this.logger.info(`running mocha ${args.join(' ')}`) const child = fork(mochaCLIPath, args, { silent: true }) hookFork(this.logger, 'mocha', child)