Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No --harmony default and no --use_strict possible [feature request] #4757

Closed
damianobarbati opened this issue Oct 24, 2017 · 5 comments
Closed

Comments

@damianobarbati
Copy link

damianobarbati commented Oct 24, 2017

In different issues is mentioned how jest runs --harmony by default.
I don't see this happening.

  • I have the spread/rest operator ... causing a Unexpected token error but node supports it
  • explictly calling the jest binary node --harmony --use_strict ./node_modules/.bin/jest I found out jest does not support the "strict" too
imac:graphjql damz$ node --harmony --use_strict --trace-deprecation ./node_modules/.bin/jest
TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
    at new CustomError (/Users/damz/Desktop/graphjql/node_modules/errno/custom.js:18:45)
    at createError (/Users/damz/Desktop/graphjql/node_modules/errno/custom.js:42:43)
    at ce (/Users/damz/Desktop/graphjql/node_modules/errno/custom.js:48:12)
    at module.exports (/Users/damz/Desktop/graphjql/node_modules/errno/custom.js:52:25)
    at Object.<anonymous> (/Users/damz/Desktop/graphjql/node_modules/errno/errno.js:312:44)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
  • firing just node --harmony ./node_modules/.bin/jest works fine

Could jest allow for a nodeArguments where we can pass an array of arguments to fire node with?
Could jest support the use_strict node mode?

Versions and config:

    "jest": {
        "bail": true,
        "verbose": true,
        "transformIgnorePatterns": [
            "!node_modules/react-runtime"
        ],
        "setupFiles": [
            "raf/polyfill"
        ],
        "transform": {}
    },

"babel-jest": "^21.2.0",
"eslint-plugin-jest": "^21.2.0",
"jest": "^21.2.1",
@SimenB
Copy link
Member

SimenB commented Oct 24, 2017

Update to latest version of the babel-preset-jest (might be beta) and rest spread works.

Could jest allow for a nodeArguments where we can pass an array of arguments to fire node with?

Why? You can add them yourself (as you've demonstrated in the OP)

Could jest support the use_strict node mode?

Not sure what we can do about the strict mode, all of Jest's own code is strict already. The error seems to come from errno which we transitively from worker-farm.

@damianobarbati
Copy link
Author

@SimenB let me thank you for helping first.
I'm currently testing node-only modules so I actually don't need transpiling: what's missing here?

Ok about the node args: let's just explicitly pass them and call the jest binary directly.

Ok about the strict mode: so it's actually failing because of dependencies not strict-compliant.

@SimenB
Copy link
Member

SimenB commented Oct 24, 2017

Jest internally uses babel. See #4248 for an explanation (including a workaround) and #4519 for the fix in Jest.

I'm gonna close as this is not actionable for us 🙂 Ping me if you disagree, though!

@SimenB SimenB closed this as completed Oct 24, 2017
@damianobarbati
Copy link
Author

damianobarbati commented Oct 24, 2017

Oh reading #4519 it looks like the problem is istanbul and not jest: jest --no-cache works while jest --no-cache --coverage fails!
Thanks @SimenB for pointing me to the right direction, I would never spot that xD

But I have the istanbul version you mentioned and my jest is already locally installed (not globally):

imac:graphjql damz$ npm ls istanbul-lib-instrument
[email protected] /Users/damz/Desktop/graphjql
├─┬ [email protected]
│ └─┬ [email protected]
│   └── [email protected] 
└─┬ [email protected]
  └─┬ [email protected]
    ├─┬ [email protected]
    │ └── [email protected]  deduped
    └── [email protected]  deduped

@digitalkaoz did you just fix this installing jest locally to the project? I already have but same error!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants