Jest-dom: Codesandbox expect is not defined

Created on 18 Mar 2019  路  8Comments  路  Source: testing-library/jest-dom

  • jest-dom version: 3.1.3
  • react-testing-library version: 6.0.0

Relevant code or config:

https://codesandbox.io/s/ymjjk77x0z

What you did:


There are 2 files in the __tests__ folder, one imports jest-dom and another does not.

ErrorFormatDateView.test.js Does import jest-dom and breaks by not finding the expect export.

FormatDateView.test.js Does not import, and using other matches can pass the test case.

Suggested solution:

jest-dom/extend-expect should export a default expect from jest.

Most helpful comment

I'll make sure to put the fix in the update tomorrow!

All 8 comments

This is a codesandbox bug

Cc @compuives, of all the things that codesandbox could do, this is the number one thing I would like: fix the testing story so this works like it used to.

I'll make sure to put the fix in the update tomorrow!

I've tested it today and seems to be working fine.
image

Thanks for the effort guys.
Thanks @CompuIves!

Wow that was fast! Thanks @CompuIves!

Wanted to bring this issue back up, as there's another issue having similar problems in running unit tests from CodeSandbox:

https://github.com/codesandbox/codesandbox-client/issues/2311

Trying to run unit tests from the CodeSandbox above doesn't work, it just stagnates and nothing happens.

Fix is underway!

Top dank je wel!

Was this page helpful?
0 / 5 - 0 ratings