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

"TypeError: matcherResult.message is not a function" after upgrade jest to latest version (27.0.3) #39

Closed
alexneo2003 opened this issue Jun 4, 2021 · 17 comments

Comments

@alexneo2003
Copy link
Contributor

Bug

"TypeError: matcherResult.message is not a function" exception after upgrade jest to latest version (27.0.3)

npx envinfo --preset jest

System:
OS: Windows 10 10.0.19043
CPU: (6) x64 Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
Binaries:
Node: 14.16.0
Yarn: 1.22.5
npm: 6.14.11
npmPackages:
jest: ^27.0.3 => 27.0.3
jest-expect-message: 1.0.2

Relevant code or config

module.exports = {
  preset: 'ts-jest',
  reporters: [
    'default',
    'jest-html-reporters',
  ],
  runner: 'groups',
  setupFilesAfterEnv: ['jest-expect-message'],
};

What you did:
upgrade jest to latest version 27.0.3

What happened (please provide anything you think will help):
when expect was failed instead receive custom message with error text i'm receive exception:

TypeError: matcherResult.message is not a function

Reproduction repository (if possible):
yarn install jest@27.0.3

expect(false, "false can't be true").toBe(true);
alexneo2003 added a commit to alexneo2003/jest-expect-message that referenced this issue Jun 9, 2021
@alexneo2003
Copy link
Contributor Author

alexneo2003 commented Jun 22, 2021

i'm published package @alex_neo/jest-expect-message
check pls
connect to project as

  setupFilesAfterEnv: ['@alex_neo/jest-expect-message'],

@adrian-kriegel
Copy link

downgrading to jest@26.6.3 fixes the issue for now

@goldfita
Copy link

goldfita commented Sep 7, 2021

I am also getting this message on Jest 27.1.0.

@alexneo2003
Copy link
Contributor Author

I am also getting this message on Jest 27.1.0.

#39 (comment)

@pete-hotchkiss
Copy link

I've been puzzled by this since upgrading to 27.x.y so have eventually given in and raised a ticket on the Jest repos

jestjs/jest#11933

rix0rrr added a commit to aws/jsii that referenced this issue Oct 7, 2021
The combination of:

* jest 27
* ts-jest
* jest-expect-message

Leads to any test that wants to report an error message failing with
the error:

```
TypeError: matcherResult.message is not a function
```

(ref: mattphillips/jest-expect-message#39)

The result is that the actual error is swallowed, and this is very
unhelpful.

Since we only used to use `jest-expect-message` in one place anyway,
remove it.
mergify bot pushed a commit to aws/jsii that referenced this issue Oct 7, 2021
The combination of:

* jest 27
* ts-jest
* jest-expect-message

Leads to any test that wants to report an error message failing with
the error:

```
TypeError: matcherResult.message is not a function
```

(ref: mattphillips/jest-expect-message#39)

The result is that the actual error is swallowed, and this is very
unhelpful.

Since we only used to use `jest-expect-message` in one place anyway,
remove it.



---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
@bennycode
Copy link

@alexneo2003 can you please contribute your code to the main package here? @mattphillips are you looking into this problem?

@alexneo2003
Copy link
Contributor Author

alexneo2003 commented Oct 10, 2021

@alexneo2003 can you please contribute your code to the main package here? @mattphillips are you looking into this problem?

Check this comment

@denyo
Copy link

denyo commented Oct 11, 2021

@alexneo2003 can you please contribute your code to the main package here? @mattphillips are you looking into this problem?

The PR is open for like 4 months: #40

@alexn-s
Copy link

alexn-s commented Dec 21, 2021

still getting the issue

@alexneo2003
Copy link
Contributor Author

alexneo2003 commented Dec 21, 2021

package @alex_neo/jest-expect-message check pls connect to project as

  setupFilesAfterEnv: ['@alex_neo/jest-expect-message'],

try modified package @alex_neo/jest-expect-message
connect to project as

 setupFilesAfterEnv: ['@alex_neo/jest-expect-message'],

tlindsay added a commit to fastly/jest-expect-message that referenced this issue Apr 4, 2022
@nicolasturcksin
Copy link

Hi,

First Thanks for the Job 👍 , but seems that this version is not publish on npm (I'm maybe wrong), in case I'm right would it be possible to publish the last version ?

Thanks!

@alexneo2003
Copy link
Contributor Author

Hi,

First Thanks for the Job 👍 , but seems that this version is not publish on npm (I'm maybe wrong), in case I'm right would it be possible to publish the last version ?

Thanks!

try modified package @alex_neo/jest-expect-message
connect to project as

 setupFilesAfterEnv: ['@alex_neo/jest-expect-message'],

@nicolasturcksin
Copy link

Yep works, is this project dead ?

Thanks !

@alexneo2003
Copy link
Contributor Author

rather yes than no

Yep works, is this project dead ?

Thanks !

rather yes than no

@alexneo2003
Copy link
Contributor Author

modified package @alex_neo/jest-expect-message
connect to project as

 setupFilesAfterEnv: ['@alex_neo/jest-expect-message'],

mattphillips pushed a commit that referenced this issue Sep 8, 2022
@mattphillips
Copy link
Owner

Sorry for the delay in coming to this!!! I've just published a new version with the fix for this in: https://www.npmjs.com/package/jest-expect-message/v/1.0.4

@bennycode
Copy link

Better a year late than never! Thank you. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants