-
-
Notifications
You must be signed in to change notification settings - Fork 57
bug: npm test fails on Windows - Jest invoked via bash shim #129
Copy link
Copy link
Open
Description
Problem
npm test fails immediately on Windows with a SyntaxError:
> node --experimental-vm-modules node_modules/.bin/jest --coverage --coverageReporters=text-summary
F:\PROJECTS\GSoC\accord\template-engine\node_modules\.bin\jest:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
What's happening
The test script in package.json runs node node_modules/.bin/jest. On Linux/macOS this works because .bin/jest is a symlink to the actual JS file. On Windows, .bin/jest is a bash shell shim, so Node tries to parse it as JavaScript and crashes.
The coverage script has the same problem.
Build and lint work fine, only test/coverage are broken.
Fix
Replace node_modules/.bin/jest with node_modules/jest-cli/bin/jest.js. That's the actual JS entry point and works on all platforms. The --experimental-vm-modules flag stays the same.
I'll submit a PR for this.
Environment
- Windows 11
- Node v22.16.0
- template-engine v2.7.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels