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

1.x broken with latest Jest and Jasmine runner #371

Closed
robross0606 opened this issue Oct 19, 2021 · 2 comments
Closed

1.x broken with latest Jest and Jasmine runner #371

robross0606 opened this issue Oct 19, 2021 · 2 comments

Comments

@robross0606
Copy link

Bug

  • package version: 1.1.0
  • node version: 14.18.1
  • npm (or yarn) version: 6.14.12
  • jest version: 27.2.5

Relevant code or config

Use Jest v27 with Jasmine test runner configured in package.json:

  "jest": {
    "testEnvironment": "node",
    "testRunner": "jest-jasmine2",
    "setupFilesAfterEnv": [
      "jest-extended/all"
    ]
  }

What happened (please provide anything you think will help):

Results in errors on every test:

 FAIL  src/__tests__/ncp-context.test.js
  ● Test suite failed to run

    TypeError: Cannot redefine property: toBeAfter
        at Function.defineProperty (<anonymous>)

      at node_modules/jest-jasmine2/node_modules/expect/build/jestMatchersObject.js:103:14
          at Array.forEach (<anonymous>)
      at Object.<anonymous> (node_modules/jest-extended/dist/all/index.js:12:14)

 FAIL  src/__tests__/access.test.js
  ● Test suite failed to run

    TypeError: Cannot redefine property: toBeAfter
        at Function.defineProperty (<anonymous>)

      at node_modules/jest-jasmine2/node_modules/expect/build/jestMatchersObject.js:103:14
          at Array.forEach (<anonymous>)
      at Object.<anonymous> (node_modules/jest-extended/dist/all/index.js:12:14)

 FAIL  src/__tests__/client.test.js
  ● Test suite failed to run

    TypeError: Cannot redefine property: toBeAfter
        at Function.defineProperty (<anonymous>)

      at node_modules/jest-jasmine2/node_modules/expect/build/jestMatchersObject.js:103:14
          at Array.forEach (<anonymous>)
      at Object.<anonymous> (node_modules/jest-extended/dist/all/index.js:12:14)

 FAIL  src/__tests__/clientOptions.js
  ● Test suite failed to run

    TypeError: Cannot redefine property: toBeAfter
        at Function.defineProperty (<anonymous>)

      at node_modules/jest-jasmine2/node_modules/expect/build/jestMatchersObject.js:103:14
          at Array.forEach (<anonymous>)
      at Object.<anonymous> (node_modules/jest-extended/dist/all/index.js:12:14)

 FAIL  src/__tests__/request-context.test.js
  ● Test suite failed to run

    TypeError: Cannot redefine property: toBeAfter
        at Function.defineProperty (<anonymous>)

      at node_modules/jest-jasmine2/node_modules/expect/build/jestMatchersObject.js:103:14
          at Array.forEach (<anonymous>)
      at Object.<anonymous> (node_modules/jest-extended/dist/all/index.js:12:14)

 FAIL  src/__tests__/request-context-trace.test.js
  ● Test suite failed to run

    TypeError: Cannot redefine property: toBeAfter
        at Function.defineProperty (<anonymous>)

      at node_modules/jest-jasmine2/node_modules/expect/build/jestMatchersObject.js:103:14
          at Array.forEach (<anonymous>)
      at Object.<anonymous> (node_modules/jest-extended/dist/all/index.js:12:14)
@robross0606
Copy link
Author

robross0606 commented Oct 19, 2021

On more investigation, I think this may be collision between jest-extended, expect-more-jest and console-testing-library. The new jest and jasmine setup appears to not allow redefinition of expectations so now there are collisions.

@SimenB
Copy link
Member

SimenB commented Oct 20, 2021

Fixed in Jest yesterday: jestjs/jest#11978. 27.3.1 has the fix 🙂

@SimenB SimenB closed this as completed Oct 20, 2021
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

2 participants