Skip to content

[BUG] engine-bridge npm test crashes: node invoked directly on shell shim #159

Description

@N-thnI

Status: ✅ Resolved on main — fixed by PR #157, commit 7073d25. Verified against a freshly-fetched origin/main before editing this issue.

Description

npm test in engine-bridge could not run at all in some environments (Windows/Git Bash confirmed). The script invoked the Jest binary shim directly with node, but that shim is a POSIX shell script, not JavaScript.

Affected Component

engine-bridge/package.json

Original Behavior (Bug)

"test": "node --experimental-vm-modules node_modules/.bin/jest --runInBand"

Running npm test threw:

node_modules\.bin\jest:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^
SyntaxError: missing ) after argument list

because node was trying to parse a #!/bin/sh script as JavaScript.

Expected Behavior

npm test runs the full Jest suite regardless of platform or which shim npm generated for .bin/jest.

Root Cause

node_modules/.bin/jest is a POSIX shell wrapper (#!/bin/sh) around Jest's real entry point. Invoking it with node <path> only works where the resolved .bin/jest happens to be a JS shim, which isn't guaranteed across npm versions/platforms.

Resolution

package.json's test script now invokes Jest's actual JS entry point directly, which is portable since it's executed via node rather than a shell:

"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand"

Confirmed present on main at time of writing.

Verification

$ git show origin/main:engine-bridge/package.json | grep '"test"'
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand",

$ npm test
Test Suites: 10 passed, 10 total
Tests:       64 passed, 64 total
  • AC-1: npm test runs and all 64 tests pass on Windows and Linux/macOS (Windows verified directly; Linux/macOS rely on the same portable node <file>.js invocation, which has no platform-specific shim dependency).
  • AC-2: No change to test behavior beyond fixing the invocation — same 64 tests, same assertions.

Definition of Done

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26bugSomething isn't workingengine-coreRust/Soroban engine-core crate

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions