Skip to content

Commit 6e0469f

Browse files
committed
ci: simplify edge-runtime job
1 parent feefc01 commit 6e0469f

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,7 @@ jobs:
186186
script: |
187187
core.setFailed('dist cache hit failed')
188188
- name: Run Test Suite
189-
run: npm run tap:edge-runtime | tee edge-runtime.tap
190-
- id: parse
191-
uses: Coderlane/tap-action@d5de2302c571f90ccb2d2e9416eaca4efe3185dd
192-
- if: ${{ steps.parse.outputs.tap_fail != '0' }}
193-
uses: actions/github-script@v6
194-
with:
195-
script: |
196-
core.setFailed('npm run tap:edge-runtime failed')
189+
run: npm run tap:edge-runtime
197190

198191
browsers:
199192
needs:

tap/.edge-runtime.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import * as fs from 'node:fs'
2+
import { EdgeRuntime } from 'edge-runtime'
3+
4+
const script = fs.readFileSync('./tap/run-edge-runtime.js', { encoding: 'utf-8' })
5+
6+
const runtime = new EdgeRuntime()
7+
runtime.evaluate(script)
8+
9+
let stats
10+
do {
11+
await new Promise((resolve) => setTimeout(resolve, 1000))
12+
;({ stats } = runtime.context)
13+
} while (!stats)
14+
15+
if (stats?.failed !== 0) {
16+
process.exit(1)
17+
}

tap/.edge-runtime.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
./node_modules/.bin/esbuild --format=esm --bundle --target=esnext tap/run-edge-runtime.ts > tap/run-edge-runtime.js
2-
./node_modules/.bin/edge-runtime tap/run-edge-runtime.js
2+
node tap/.edge-runtime.mjs

tap/run-edge-runtime.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import QUnit from 'qunit'
22
import run from './run.js'
33

4-
run(QUnit)
4+
run(QUnit, (stats) => {
5+
// @ts-ignore
6+
globalThis.stats = stats
7+
})

0 commit comments

Comments
 (0)