Skip to content

Commit 8d67f28

Browse files
authored
Fix Cross-platform issue with npm script (#397)
* Make commands work cross-env * make npm format work as well.
1 parent 3d2a28e commit 8d67f28

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ jobs:
4343
strategy:
4444
matrix:
4545
browser: [chrome, firefox, safari]
46-
env:
47-
BROWSER: ${{ matrix.browser }}
4846
steps:
4947
- name: Checkout Branch
5048
uses: actions/checkout@v3
@@ -58,4 +56,4 @@ jobs:
5856
- name: Run tests
5957
run: |
6058
echo "Running in $BROWSER"
61-
node tests/run.mjs
59+
npm run test:${{ matrix.browser }}

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
"lint:fix": "eslint \"**/*.{js,mjs,jsx,ts,tsx}\" --fix",
2222
"pretty:check": "prettier --check ./",
2323
"pretty:fix": "prettier --write ./",
24-
"format": "npm run pretty:fix ; npm run lint:fix",
25-
"test:chrome": "BROWSER=chrome node tests/run.mjs",
26-
"test:firefox": "BROWSER=firefox node tests/run.mjs",
27-
"test:safari": "BROWSER=safari node tests/run.mjs",
28-
"test:edge": "BROWSER=edge node tests/run.mjs"
24+
"format": "npm run pretty:fix && npm run lint:fix",
25+
"test:chrome": "node tests/run.mjs --browser chrome",
26+
"test:firefox": "node tests/run.mjs --browser firefox",
27+
"test:safari": "node tests/run.mjs --browser safari",
28+
"test:edge": "node tests/run.mjs --browser edge"
2929
},
3030
"devDependencies": {
3131
"@babel/core": "^7.21.3",

tests/run.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const options = commandLineArgs(optionDefinitions);
3939
if ("help" in options)
4040
printHelp();
4141

42-
const BROWSER = options?.browser || process.env.BROWSER;
42+
const BROWSER = options?.browser;
4343
if (!BROWSER)
4444
printHelp("No browser specified, use $BROWSER or --browser");
4545

0 commit comments

Comments
 (0)