Skip to content

Commit d076067

Browse files
committed
fix(sea): F2 e2e — switch fs/path to named imports under ESM reparse
mocha 11+'s MODULE_TYPELESS_PACKAGE_JSON reparse-as-ESM path breaks `import * as fs from 'fs'` / `import * as path from 'path'`: under ESM, the namespace import doesn't expose the CJS module's exports as own properties, so `path.resolve(...)` was undefined at runtime. Switch to named imports (`resolve as resolvePath` aliased to keep the call site readable). Same fix applied to F4 and F3b in their respective branches. Verified live e2e passes against pecotesting after the fix. Co-authored-by: Isaac Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
1 parent cc97b18 commit d076067

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/e2e/sea/complex-types-e2e.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535

3636
import { expect } from 'chai';
3737
import { tableFromIPC, Type as ArrowType } from 'apache-arrow';
38-
import * as fs from 'fs';
39-
import * as path from 'path';
38+
import { existsSync } from 'fs';
39+
import { resolve as resolvePath } from 'path';
4040
import { createRequire } from 'module';
4141

4242
// Prerequisites for the live e2e:
@@ -97,11 +97,11 @@ describe('SEA complex types — native Arrow default', function suite() {
9797
// reparse this file as ESM (MODULE_TYPELESS_PACKAGE_JSON path)
9898
// where `__dirname` is undefined. mocha always runs with cwd at
9999
// the package root, so this resolves consistently.
100-
const nodeArtifact = path.resolve(
100+
const nodeArtifact = resolvePath(
101101
process.cwd(),
102102
'native/sea/index.linux-x64-gnu.node',
103103
);
104-
if (!fs.existsSync(nodeArtifact)) {
104+
if (!existsSync(nodeArtifact)) {
105105
// eslint-disable-next-line no-console
106106
console.warn(
107107
`[sea complex-types e2e] skipping: native binary not built. ` +

0 commit comments

Comments
 (0)