Skip to content

Commit 48af4e3

Browse files
committed
build: fix test ci checkout
1 parent 1b51488 commit 48af4e3

5 files changed

Lines changed: 51 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
with:
2121
egress-policy: audit
2222

23+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
24+
2325
- name: Use Node.js ${{ matrix.node-version }}
2426
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
2527
with:
@@ -31,4 +33,8 @@ jobs:
3133
- name: Install dependencies
3234
run: npm ci
3335
- name: npm test
36+
if: matrix.node-version != '20.x'
3437
run: npm run node:test
38+
- name: npm test with amaro
39+
if: matrix.node-version == '20.x'
40+
run: npm run node-v20:test

package-lock.json

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

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
"private": true,
55
"type": "module",
66
"scripts": {
7-
"node:test": "node --test ./implementors/node/run-tests.ts"
7+
"node:test": "node --test ./implementors/node/run-tests.ts",
8+
"node-v20:test": "node --import=./tools/strip.js --test ./implementors/node/run-tests.ts"
89
},
910
"devDependencies": {
1011
"@types/node": "^24.10.1"
12+
},
13+
"dependencies": {
14+
"amaro": "^1.1.5"
1115
}
1216
}

tools/loader.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import path from 'node:path';
2+
3+
export async function resolve(specifier, context, nextResolve) {
4+
const result = await nextResolve(specifier, context);
5+
const ext = path.extname(new URL(result.url).pathname);
6+
if (ext === '.ts') {
7+
return {
8+
...result,
9+
format: 'module',
10+
};
11+
}
12+
return result;
13+
}
14+
15+
export async function load(url, context, nextLoad) {
16+
const ext = path.extname(new URL(url).pathname);
17+
if (ext === '.ts') {
18+
return nextLoad(url, {
19+
...context,
20+
format: 'module-typescript',
21+
});
22+
}
23+
return nextLoad(url, context);
24+
}

tools/strip.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { register } from 'node:module';
2+
import 'amaro/strip';
3+
4+
register('./loader.js', import.meta.url);

0 commit comments

Comments
 (0)