Jest: Jest debug on Windows: SyntaxError: missing ) after argument list

Created on 6 Jun 2017  路  8Comments  路  Source: facebook/jest


Do you want to request a feature or report a bug?
Report bug

What is the current behavior?
On Windows 7 Pro:

$ node --debug-brk ./node_modules/.bin/jest --runInBand
Debugger listening on [::]:5858
C:\home\ng2\cis-dashboard\web-api\frontend\node_modules\.bin\jest:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^
SyntaxError: missing ) after argument list
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Timeout.Module.runMain [as _onTimeout] (module.js:604:10)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)

What is the expected behavior?
Jest to run in node debugger.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Windows 7 Pro
jest v20.0.4
jest-preset-angular v2.0.2

Istanbul had a similar issue on Windows:

Windows

Most helpful comment

On Windows you can run it by the path instead of bin :

node --debug-brk ./node_modules/jest/bin/jest.js --runInBand

All 8 comments

On Windows you can run it by the path instead of bin :

node --debug-brk ./node_modules/jest/bin/jest.js --runInBand

@charpeni That fix worked for me (Windows 10) after I first removed --debug-brk. Thanks.

I'll reopen the issue because the underlying one seems to not have been fixed.
Any ideas why .bin/jest is broken on Windows?

I reckon it has to do with Jest using Istanbul and this being an issue of Istanbul:

https://github.com/gotwarlost/istanbul#usage-on-windows

The command seems to run. I use node Inspector Manager to open automatically the debugger. However, I see no output in there.

Edit
Found an anwser here: https://stackoverflow.com/a/39641938/1903781

My 2c on windows:

node --inspect ./node_modules/jest-cli/bin/jest.js --runInBand --watch /src/tests/

is working for me, note jest-cli in the path

I don't think this is jest's fault. On windows in cmd, you need to run node_modules/.bin/jest.cmd - that's how bin works.

image

To pass flags, use NODE_OPTIONS

I don't think this strictly a windows issue:
https://share.getcloudapp.com/YEudr74D

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stephenlautier picture stephenlautier  路  3Comments

StephanBijzitter picture StephanBijzitter  路  3Comments

ianp picture ianp  路  3Comments

samzhang111 picture samzhang111  路  3Comments

paularmstrong picture paularmstrong  路  3Comments