Skip to content

Commit

Permalink
Fix Cross-platform issue with npm script (WebKit#397)
Browse files Browse the repository at this point in the history
* Make commands work cross-env

* make npm format work as well.
  • Loading branch information
issackjohn committed Mar 7, 2024
1 parent 3d2a28e commit 8d67f28
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ jobs:
strategy:
matrix:
browser: [chrome, firefox, safari]
env:
BROWSER: ${{ matrix.browser }}
steps:
- name: Checkout Branch
uses: actions/checkout@v3
Expand All @@ -58,4 +56,4 @@ jobs:
- name: Run tests
run: |
echo "Running in $BROWSER"
node tests/run.mjs
npm run test:${{ matrix.browser }}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tests/run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

0 comments on commit 8d67f28

Please sign in to comment.