Skip to content

Commit e4f7865

Browse files
authored
test lower node versions properly (#661)
previous CI setup wasn't actually running, it was throwing an uncaught rejection and somehow exiting with code 0 anyway getting vitest to work on node 12 was miles away from working, so moving the node version tests to the `test_tgz` job, which is a simpler test that ensures the basics work. Also adds some small fixes to the library itself to get it _closer_ to working, but the `glob` dependency is the sticking point for node 12. 14, 16, 18 are now fine. `glob` dependency will be replaced in #660 If getting node 12 to work proves impossible, we might need to just go to a v4 release but hopefully not.
1 parent cbfaadb commit e4f7865

File tree

6 files changed

+20
-189
lines changed

6 files changed

+20
-189
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,11 @@ jobs:
77
steps:
88
- uses: actions/checkout@v4
99
- run: corepack enable
10-
# rather than use strategy.matrix, install once and run multiple times. Some of the devDependencies refuse to install on lower node versions, but we still want to test on them
1110
- run: pnpm install
1211
- run: pnpm lint
1312
- run: pnpm test -- --coverage
1413
- name: Coverage
1514
uses: codecov/codecov-action@v3
16-
- name: Setup node 14
17-
uses: actions/setup-node@v4
18-
with:
19-
node-version: 14.x
20-
- run: npm test
21-
22-
# pretest depends on del-cli which doesn't support node 12, so run manually
23-
# todo: drop node 12 in next major
24-
- run: npm run pretest
25-
- name: Setup node 12
26-
uses: actions/setup-node@v4
27-
with:
28-
node-version: 12.x
29-
- run: npm test --ignore-scripts
3015
create_tgz:
3116
runs-on: ubuntu-latest
3217
steps:
@@ -44,7 +29,13 @@ jobs:
4429
test_tgz:
4530
runs-on: ubuntu-latest
4631
needs: [create_tgz]
32+
strategy:
33+
matrix:
34+
node: [20, 18, 16, 14, 12]
4735
steps:
36+
- uses: actions/setup-node@v4
37+
with:
38+
node-version: ${{ matrix.node }}
4839
- uses: actions/checkout@v4
4940
- uses: actions/download-artifact@v3
5041
with:

eslint.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
module.exports = [
22
...require('eslint-plugin-mmkal').recommendedFlatConfigs,
33
{ignores: ['lib/**', 'examples/**', 'test/generated/**']}, //
4+
{
5+
rules: {
6+
// todo[>=4.0.0] drop lower node version support and remove these
7+
'unicorn/prefer-string-replace-all': 'off',
8+
'unicorn/prefer-at': 'off',
9+
},
10+
},
411
]

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"@vitest/coverage-v8": "^0.34.6",
3030
"@vitest/ui": "^0.34.6",
3131
"del": "^5.0.0",
32-
"del-cli": "5.1.0",
3332
"eslint": "8.57.0",
3433
"eslint-plugin-mmkal": "0.5.1",
3534
"execa": "^5.1.1",
@@ -49,13 +48,13 @@
4948
"vitest": "^0.34.6"
5049
},
5150
"scripts": {
52-
"clean": "del-cli lib",
51+
"clean": "rm -rf lib",
5352
"compile": "tsc -p tsconfig.lib.json",
5453
"build": "pnpm clean && pnpm compile",
5554
"eslint": "eslint . --max-warnings 0",
5655
"lint": "pnpm type-check && pnpm eslint",
5756
"prepare": "pnpm build",
58-
"pretest": "del-cli test/generated",
57+
"pretest": "rm -rf test/generated",
5958
"test": "vitest run",
6059
"type-check": "tsc -p ."
6160
},

pnpm-lock.yaml

Lines changed: 0 additions & 167 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)