Skip to content

unhelpful error stack from expectationResultFactory stackFormatter #3839

@capaj

Description

@capaj

I have got an error from jest which leaves me blind to the actual problem that caused it:

  ● api functional tests › Can do password reset

    Failed: SyntaxError
      
      at stackFormatter (node_modules/jest-jasmine2/build/expectationResultFactory.js:30:20)
          at <anonymous>

Is it really necessary to create a new error there? Syntax error should always contain a line and collumn so couldn't jest just pass that?
https://github.com/facebook/jest/blob/master/packages/jest-jasmine2/src/expectationResultFactory.js#L30

My node: 8.1.0
My jest: 20.0.4

EDIT:I've since took all of the code out of a test and run it inside babel-node. This error is the one that was swallowed:

Error: connect ECONNREFUSED 127.0.0.1:80
    at Object.exports._errnoException (util.js:1014:11)
    at exports._exceptionWithHostPort (util.js:1037:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1138:14)
From previous event:
    at httpAdapter (/home/capaj/git_projects/looop/project-alpha/front-end/node_modules/axios/lib/adapters/http.js:18:10)
    at dispatchRequest (/home/capaj/git_projects/looop/project-alpha/front-end/node_modules/axios/lib/core/dispatchRequest.js:52:10)
    at __NR_wrappedThenHandler (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/newrelic/lib/instrumentation/promise.js:466:25)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)
From previous event:
    at Promise.__NR_wrappedThen (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/newrelic/lib/instrumentation/promise.js:424:23)
    at Promise.<anonymous> (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/sequelize/lib/promise.js:21:17)
    at Promise.__NR_wrappedThen [as then] (/home/capaj/git_projects/looop/project-alpha/back-end/node_modules/newrelic/lib/instrumentation/promise.js:424:23)
    at Axios.request (/home/capaj/git_projects/looop/project-alpha/front-end/node_modules/axios/lib/core/Axios.js:58:23)
    at Axios.(anonymous function) [as post] (/home/capaj/git_projects/looop/project-alpha/front-end/node_modules/axios/lib/core/Axios.js:78:17)
    at Function.wrap (/home/capaj/git_projects/looop/project-alpha/front-end/node_modules/axios/lib/helpers/bind.js:9:15)
    at Object.resetPassword (/home/capaj/git_projects/looop/project-alpha/front-end/src/api/user-api.js:15:20)
    at test (/home/capaj/git_projects/looop/project-alpha/back-end/test/password-reset.js:38:40)
    at <anonymous>

It's really a shame when the only way to debug a failing jest test is to rewrite the test in raw node.js

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions