Skip to content

Commit f2605fe

Browse files
authored
build: fix test ci checkout (#16)
1 parent 1b51488 commit f2605fe

File tree

5 files changed

+49
-0
lines changed

5 files changed

+49
-0
lines changed

.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: NODE_OPTIONS="--import=./tools/strip.js" npm run node: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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
},
99
"devDependencies": {
1010
"@types/node": "^24.10.1"
11+
},
12+
"dependencies": {
13+
"amaro": "^1.1.5"
1114
}
1215
}

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)