question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: result.message is not a function

See original GitHub issue

Version

27.x.y

Steps to reproduce

Given a super basic test simple calc function that returns sum of two values…

it("EXPECTS: to get  fail messages", ()=> {
    let calc = (a, b) => a + b;

    expect(calc(1,2)).toEqual(4);
  })

Expected behavior

if the expected value isn’t met - then I would expect a message we gave a verbose breakdown of expected and actual values (see below for output as run using Jest 26.x.y) image

Actual behavior

now, when running tests, where failures occur - rather than getting detailed output of expected and actual results; the console is only able to display a TypeError: result.message is not a function message

image

Additional context

No response

Environment

System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz
  Binaries:
    Node: 12.0.0 - ~/.nvm/versions/node/v12.0.0/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v12.0.0/bin/npm
  npmPackages:
    jest: ^27.2.4 => 27.2.4

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
pete-hotchkisscommented, Oct 6, 2021

hmmm - interesting.

So I did that (repos updated) and behavior is as expected. Suggests the problem is with ts-jest

** update ** (mainly for others that might stumble/land here in the future) bit more tinkering around this, suggests it’s not even ts-jest - but actually in jest-chain as removing it from the typescript version delivers the expected behavior

see - https://github.com/mattphillips/jest-chain/issues/34

0reactions
github-actions[bot]commented, Nov 12, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: result.message is not a function · Issue #34 - GitHub
Hi, From what I see in chain.js, the JestAssertionError constructor considers result.message as a function when its actually a string. At ...
Read more >
any Jest test fails with "result.message is not a function" after ...
After upgrading Jest to v.27.2.5 from v.26 if a test fails it shows me: result.message is not a function.
Read more >
TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >
How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript TypeError: "x" is not a function occurs when calling a function on a value or object, which is not actually a...
Read more >
How to solve the "is not a function" error in JavaScript
js we use require() to load external modules and files. This can cause, in some cases, an error like this: TypeError: require(...) is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found