mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
update the spectron tests script and add support for case insensitive command line args parsing
This commit is contained in:
parent
d1c1e3caa2
commit
72108ea213
@ -4,7 +4,7 @@ const log = require('../log.js');
|
||||
const logLevels = require('../enums/logLevels.js');
|
||||
|
||||
/**
|
||||
* Search given argv for argName using exact match or starts with.
|
||||
* Search given argv for argName using exact match or starts with. Comparison is case insensitive
|
||||
* @param {Array} argv Array of strings
|
||||
* @param {String} argName Arg name to search for.
|
||||
* @param {Boolean} exactMatch If true then look for exact match otherwise
|
||||
@ -16,10 +16,11 @@ function getCmdLineArg(argv, argName, exactMatch) {
|
||||
log.send(logLevels.WARN, 'getCmdLineArg: TypeError invalid func arg, must be an array: '+ argv);
|
||||
return null;
|
||||
}
|
||||
|
||||
let argNameToFind = argName.toLocaleLowerCase();
|
||||
for (let i = 0, len = argv.length; i < len; i++) {
|
||||
if ((exactMatch && argv[i] === argName) ||
|
||||
(!exactMatch && argv[i].startsWith(argName))) {
|
||||
let arg = argv[i].toLocaleLowerCase();
|
||||
if ((exactMatch && arg === argNameToFind) ||
|
||||
(!exactMatch && arg.startsWith(argNameToFind))) {
|
||||
return argv[i];
|
||||
}
|
||||
}
|
||||
@ -27,4 +28,4 @@ function getCmdLineArg(argv, argName, exactMatch) {
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = getCmdLineArg;
|
||||
module.exports = getCmdLineArg;
|
@ -12,9 +12,8 @@
|
||||
"browserify-preload": "browserify -o js/preload/_preloadMain.js -x electron --insert-global-vars=__filename,__dirname js/preload/preloadMain.js --exclude electron-spellchecker",
|
||||
"rebuild": "electron-rebuild -f",
|
||||
"dev": "npm run prebuild && && npm run set-dev-env && electron .",
|
||||
"pretest": "npm run lint && npm rebuild --build-from-source ",
|
||||
"test": "npm run pretest && cross-env ELECTRON_QA=true jest --config tests/jest_unit.json --runInBand && npm run rebuild",
|
||||
"spectron-test": "npm run pretest && cross-env ELECTRON_QA=true jest --config tests/spectron/jest_spectron.json --runInBand && npm run rebuild",
|
||||
"test": "npm run lint && npm rebuild --build-from-source && cross-env ELECTRON_QA=true jest --config tests/jest_unit.json --runInBand && npm run rebuild",
|
||||
"spectron-test": "npm run lint && npm rebuild --build-from-source robotjs && cross-env ELECTRON_QA=true jest --config tests/spectron/jest_spectron.json --runInBand && npm run rebuild",
|
||||
"demo-win": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file:///demo/index.html",
|
||||
"demo-mac": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file://$(pwd)/demo/index.html",
|
||||
"search-win": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file:///demo/search.html",
|
||||
|
Loading…
Reference in New Issue
Block a user