From 9b6e182bf6bd4b5e73266d51065a9e529bf4b575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Sun, 2 Jun 2019 21:38:24 +0200 Subject: [PATCH] simplify arg handling --- bin/test.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/test.js b/bin/test.js index 6a5107ae..2cdd1b3b 100644 --- a/bin/test.js +++ b/bin/test.js @@ -10,7 +10,7 @@ const path = require('path'); const env = { ...process.env }; env.NODE_PATH = path.resolve(__dirname, '../out'); -const args = [ +let testFiles = [ './out/*test.js', './out/**/*test.js', './out/*integration.js', @@ -20,11 +20,13 @@ const args = [ // ability to inject particular test files via // yarn test [testFileA testFileB ...] -const testFilesFromArgs = process.argv.slice(2); +if (process.argv.length > 2) { + testFiles = process.argv.slice(2); +} cp.spawnSync( path.resolve(__dirname, '../node_modules/.bin/mocha'), - (testFilesFromArgs.length) ? testFilesFromArgs : args, + testFiles, { cwd: path.resolve(__dirname, '..'), env,