Fix Cross-platform issue with npm script (#397)
* Make commands work cross-env * make npm format work as well.
This commit is contained in:
parent
3d2a28e2dc
commit
8d67f28d02
3 changed files with 7 additions and 9 deletions
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
|
|
@ -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 }}
|
||||
|
|
|
|||
10
package.json
10
package.json
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue