From df7ba37d57a5a4a548a1fec627eb9f8147d77473 Mon Sep 17 00:00:00 2001 From: kumaran-14 Date: Sat, 11 Apr 2020 21:15:24 +0530 Subject: [PATCH] Update args parser to allow flag values --- bin/test_api.js | 5 ++++- package.json | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/test_api.js b/bin/test_api.js index 2eb3fc3e1..38e9af3e8 100644 --- a/bin/test_api.js +++ b/bin/test_api.js @@ -21,7 +21,8 @@ let flagArgs = []; if (process.argv.length > 2) { const args = process.argv.slice(2); - flagArgs = args.filter(e => e.startsWith('--')); + flagArgs = args.filter(e => e.startsWith('--')).flatMap(arg => arg.split('=')); + console.info(flagArgs); // ability to inject particular test files via // yarn test [testFileA testFileB ...] files = args.filter(e => !e.startsWith('--')); @@ -30,6 +31,8 @@ if (process.argv.length > 2) { } } + + env.DEBUG = flagArgs.indexOf('--debug') >= 0 ? 'debug' : ''; const run = cp.spawnSync( diff --git a/package.json b/package.json index 535712dbf..31771a888 100644 --- a/package.json +++ b/package.json @@ -14,11 +14,10 @@ "lint": "eslint -c .eslintrc.json --ext .ts src/ addons/", "test": "npm run test-unit", "posttest": "npm run lint", - "api-test": "node ./bin/test_api.js", "test-api": "npm run test-api-chromium", - "test-api-chromium": "mocha \"**/*.api.js\" --browser chromium --timeout 20000", - "test-api-firefox": "mocha \"**/*.api.js\" --browser firefox --timeout 20000", - "test-api-webkit": "mocha \"**/*.api.js\" --browser webkit --timeout 20000", + "test-api-chromium": "node ./bin/test_api.js --browser=chromium --timeout=20000", + "test-api-firefox": "node ./bin/test_api.js --browser=firefox --timeout=20000", + "test-api-webkit": "node ./bin/test_api.js --browser=webkit --timeout=20000", "pretest-api-chromium": "node ./bin/download_browser.js --browser chromium", "pretest-api-firefox": "node ./bin/download_browser.js --browser firefox", "pretest-api-webkit": "node ./bin/download_browser.js --browser webkit",