Fix Cross-platform issue with npm script (#397)

* Make commands work cross-env

* make npm format work as well.
This commit is contained in:
Issack John 2024-03-07 01:41:02 -08:00 committed by GitHub
parent 3d2a28e2dc
commit 8d67f28d02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 9 deletions

View file

@ -43,8 +43,6 @@ jobs:
strategy:
matrix:
browser: [chrome, firefox, safari]
env:
BROWSER: ${{ matrix.browser }}
steps:
- name: Checkout Branch
uses: actions/checkout@v3
@ -58,4 +56,4 @@ jobs:
- name: Run tests
run: |
echo "Running in $BROWSER"
node tests/run.mjs
npm run test:${{ matrix.browser }}

View file

@ -21,11 +21,11 @@
"lint:fix": "eslint \"**/*.{js,mjs,jsx,ts,tsx}\" --fix",
"pretty:check": "prettier --check ./",
"pretty:fix": "prettier --write ./",
"format": "npm run pretty:fix ; npm run lint:fix",
"test:chrome": "BROWSER=chrome node tests/run.mjs",
"test:firefox": "BROWSER=firefox node tests/run.mjs",
"test:safari": "BROWSER=safari node tests/run.mjs",
"test:edge": "BROWSER=edge node tests/run.mjs"
"format": "npm run pretty:fix && npm run lint:fix",
"test:chrome": "node tests/run.mjs --browser chrome",
"test:firefox": "node tests/run.mjs --browser firefox",
"test:safari": "node tests/run.mjs --browser safari",
"test:edge": "node tests/run.mjs --browser edge"
},
"devDependencies": {
"@babel/core": "^7.21.3",

View file

@ -39,7 +39,7 @@ const options = commandLineArgs(optionDefinitions);
if ("help" in options)
printHelp();
const BROWSER = options?.browser || process.env.BROWSER;
const BROWSER = options?.browser;
if (!BROWSER)
printHelp("No browser specified, use $BROWSER or --browser");