mattphillips/jest-expect-message

still getting "Expect takes at most one argument" error

Choongkyu opened this issue ยท 4 comments

Bug

  • package version:
  • node version:
  • npm (or yarn) version:

Relevant code or config

What you did:

  1. install pkg yarn add -D jest-expect-message
  2. add the following to my package.json:
  "jest": {
    "setupFilesAfterEnv": [
      "jest-expect-message"
    ]
  },
  1. wrote a test block and ran with Jest:
test('foo', () => {
   expect(1, 'wah wah').toBe(0);
});

What happened (please provide anything you think will help):
Failed test with this message: Expect takes at most one argument.

Reproduction repository (if possible):

kiliw commented

Same here. I installed it according to the guide but I get the same error as @zebralight . Would be nice to get it working :)

0b10 commented

You sure it isn't an eslint message? I had the same thing:

https://github.com/jest-community/eslint-plugin-jest/blob/master/docs/rules/valid-expect.md

/* eslintrc.json */
"rules": {
  "jest/valid-expect": "off",
},

or typescript:

yarn add @types/jest-expect-message --dev

Both of those fixed any issue.

Bug

  • package version:
  • node version:
  • npm (or yarn) version:

Relevant code or config

What you did:

  1. install pkg yarn add -D jest-expect-message
  2. add the following to my package.json:
  "jest": {
    "setupFilesAfterEnv": [
      "jest-expect-message"
    ]
  },
  1. wrote a test block and ran with Jest:
test('foo', () => {
   expect(1, 'wah wah').toBe(0);
});

What happened (please provide anything you think will help):
Failed test with this message: Expect takes at most one argument.

Reproduction repository (if possible):

I'm using this module from typeScript, and i had the same problem. To fix it, i had to:

  1. run yarn add @types/jest-expect-message --dev
  2. import 'jest-expect-message' from one of the test files

Going to close this as I don't think any of these issues are still valid with the latest release: https://www.npmjs.com/package/jest-expect-message/v/1.0.4

Please feel free to re-open / comment if the issues persist ๐Ÿ‘