Skip to content

Commit 4891c60

Browse files
authored
refactor: migrate tests from jest to Node.js test utils (#221)
* refactor: split app builder into separate file * test: add native node test for app * test: add native node unit tests * ci: update actions, run tests * chore: remove unused jest deps
1 parent bbd8fce commit 4891c60

File tree

29 files changed

+680
-2307
lines changed

29 files changed

+680
-2307
lines changed

.github/workflows/build.yml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@ jobs:
1818

1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v5
2222

2323
- name: Setup pnpm
2424
uses: pnpm/action-setup@v4
2525
with:
26-
version: 9.x.x
2726
run_install: false
2827

2928
- name: Setup Node
30-
uses: actions/setup-node@v4
29+
uses: actions/setup-node@v5
3130
with:
32-
node-version: 20
31+
node-version: 22
3332
cache: 'pnpm'
3433

3534
- name: Install dependencies
@@ -38,23 +37,46 @@ jobs:
3837
- name: Format and lint code
3938
run: pnpm run format && pnpm run lint
4039

40+
test:
41+
runs-on: ubuntu-22.04
42+
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v5
46+
47+
- name: Setup pnpm
48+
uses: pnpm/action-setup@v4
49+
with:
50+
run_install: false
51+
52+
- name: Setup Node
53+
uses: actions/setup-node@v5
54+
with:
55+
node-version: 22
56+
cache: 'pnpm'
57+
58+
- name: Install dependencies
59+
run: pnpm install
60+
61+
- name: Run tests
62+
run: pnpm run test
63+
4164
compile:
4265
runs-on: ubuntu-22.04
4366

4467
steps:
4568
- name: Checkout
46-
uses: actions/checkout@v4
69+
uses: actions/checkout@v5
4770

4871
- name: Setup pnpm
4972
uses: pnpm/action-setup@v4
5073
with:
51-
version: 9.x.x
5274
run_install: false
5375

5476
- name: Setup Node
55-
uses: actions/setup-node@v4
77+
uses: actions/setup-node@v5
5678
with:
57-
node-version: 20
79+
node-version: 22
5880
cache: 'pnpm'
5981

6082
- name: Install dependencies

.github/workflows/docs-deploy.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,17 @@ jobs:
1818

1919
steps:
2020
- name: Check out your repository using git
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v5
2222

2323
- name: Setup pnpm
2424
uses: pnpm/action-setup@v4
2525
with:
26-
version: 9.x.x
2726
run_install: false
2827

29-
30-
- name: Use Node.js 20
31-
uses: actions/setup-node@v4
28+
- name: Use Node.js 22
29+
uses: actions/setup-node@v5
3230
with:
33-
node-version: 20
31+
node-version: 22
3432
cache: 'pnpm'
3533

3634
- name: Install dependencies

.github/workflows/release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v5
1919
with:
2020
fetch-depth: 0
2121

@@ -28,13 +28,12 @@ jobs:
2828
uses: pnpm/action-setup@v4
2929
id: pnpm-install
3030
with:
31-
version: 9.x.x
3231
run_install: false
3332

3433
- name: Setup Node
35-
uses: actions/setup-node@v4
34+
uses: actions/setup-node@v5
3635
with:
37-
node-version: 20
36+
node-version: 22
3837
cache: 'pnpm'
3938

4039
- name: Install dependencies

__tests__/cli-integration.test.ts

Lines changed: 0 additions & 159 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.0.2",
44
"description": "CLI for automating the setup and usage of Moddable XS tools",
55
"types": "build/types/types.d.ts",
6+
"packageManager": "pnpm@10.17.1",
67
"engines": {
78
"node": ">=20"
89
},
@@ -18,10 +19,9 @@
1819
"compile": "tsc -p .",
1920
"build": "pnpm run format && pnpm run lint && pnpm run clean-build && pnpm run compile",
2021
"prepublishOnly": "pnpm run build",
21-
"test": "jest",
22-
"watch": "jest --watch",
23-
"snapupdate": "jest --updateSnapshot",
24-
"coverage": "jest --coverage",
22+
"test": "tsx --test --experimental-test-module-mocks",
23+
"watch": "pnpm test --watch",
24+
"coverage": "pnpm test --experimental-test-coverage",
2525
"start:docs": "astro dev --root ./docs",
2626
"build:docs": "astro build --root ./docs",
2727
"preview:docs": "astro preview --root ./docs",
@@ -68,7 +68,6 @@
6868
"@babel/core": ">=7.20.12 <8.0.0",
6969
"@changesets/cli": "^2.19.0",
7070
"@justinribeiro/lite-youtube": "^1.5.0",
71-
"@types/jest": "^27.4.0",
7271
"@types/node": "^18.11.19",
7372
"@types/serve-handler": "^6.1.1",
7473
"@types/tar-fs": "^2.0.1",
@@ -85,27 +84,15 @@
8584
"eslint-plugin-node": "^11.1.0",
8685
"eslint-plugin-prettier": "^5.2.1",
8786
"eslint-plugin-promise": "^7.1.0",
88-
"jest": "^29.7.0",
8987
"prettier": "^3.3.3",
9088
"rollup": "^2.78.1",
9189
"solid-js": "^1.4.3",
9290
"tailwindcss": "^3.0.24",
93-
"ts-jest": "^29.2.4",
9491
"ts-node": "^10.9.2",
9592
"tsx": "^4.19.2",
9693
"typescript": "^5.5.4",
9794
"typescript-eslint": "^8.1.0"
9895
},
99-
"jest": {
100-
"preset": "ts-jest",
101-
"testEnvironment": "node",
102-
"testPathIgnorePatterns": [
103-
"<rootDir>/build/"
104-
]
105-
},
106-
"volta": {
107-
"node": "18.14.0"
108-
},
10996
"prettier": {
11097
"semi": false,
11198
"singleQuote": true

0 commit comments

Comments
 (0)