Skip to content

Commit 30b7aee

Browse files
committed
ci(sea): run SEA e2e under nyc so ts-node/register loads .ts (fix ESM-loader race)
Bare `mocha` has no ts-node registration, so it loaded the .ts specs via the ESM dynamic-import path and crashed with ERR_INTERNAL_ASSERTION (... not yet fully loaded ... Promise.all) before any test ran. main.yml's e2e job avoids this by running `nyc mocha` — nyc.config.js's `require: ['ts-node/register']` installs the CommonJS ts-node hook, loading specs synchronously. Mirror that: invoke `nyc ... mocha --config tests/e2e/.mocharc.js <glob>`, keeping the glob at argv index 4 (the mocharc derives spec from process.argv.slice(4)). Everything else in the pipeline is now confirmed green: App-token + private-kernel checkout, ~/.npm cache, npm ci, build:native, the KERNEL_REV contract-drift assert, and the binding smoke-check. This was the last failing step. Co-authored-by: Isaac Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
1 parent 45b79c1 commit 30b7aee

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/kernel-e2e.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,18 @@ jobs:
329329
run: node -e "const b=require('./native/sea'); if(typeof b.version!=='function'){throw new Error('napi binding failed to load')} console.log('kernel binding ok:', b.version())"
330330

331331
- name: Run SEA e2e tests
332-
# Invoke mocha directly rather than via `npm run e2e -- <glob>`: routing a
333-
# glob through the npm-script's inner shell mangles `**` and silently
334-
# resolves to ZERO files (a false pass). mocha expands the quoted glob
335-
# itself, reliably matching every tests/e2e/sea file.
336-
run: NODE_OPTIONS="--max-old-space-size=4096" npx mocha --config tests/e2e/.mocharc.js "tests/e2e/sea/**/*.test.ts"
332+
# Run through `nyc` (not bare `mocha`) so the `require: ['ts-node/register']`
333+
# in nyc.config.js loads the .ts specs via the CommonJS ts-node hook —
334+
# exactly how main.yml's e2e job runs them. Bare `mocha` has no ts-node
335+
# registration, so it falls back to the ESM dynamic-import loader and
336+
# crashes with `ERR_INTERNAL_ASSERTION: ... not yet fully loaded ...
337+
# Promise.all` before any test runs.
338+
#
339+
# The glob is passed as the trailing positional and MUST stay at argv
340+
# index 4 (`mocha --config <file> <glob>`): tests/e2e/.mocharc.js derives
341+
# `spec` from `process.argv.slice(4)`. We invoke mocha directly (not via
342+
# `npm run e2e -- <glob>`, whose inner shell mangles `**` to zero files).
343+
run: NODE_OPTIONS="--max-old-space-size=4096" npx nyc --report-dir coverage_kernel_e2e mocha --config tests/e2e/.mocharc.js "tests/e2e/sea/**/*.test.ts"
337344

338345
- name: Post Kernel E2E check (success)
339346
if: success()

0 commit comments

Comments
 (0)