Skip to content

donaldpipowitch/testing-library-react-act-bug-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

"@testing-library/react": "9.3.0" without a warning:

$ yarn

$ yarn test
yarn run v1.19.1
$ jest
 PASS  src/__tests__/test.js
  ✓ formik example (54ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        1.521s
Ran all test suites.
✨  Done in 2.45s.

"@testing-library/react": "9.3.1" with a warning:

$ yarn add --dev @testing-library/[email protected]

$ yarn test
yarn run v1.19.1
$ jest
 PASS  src/__tests__/test.js
  ✓ formik example (64ms)

  console.error node_modules/react-dom/cjs/react-dom.development.js:530
    Warning: An update to Formik inside a test was not wrapped in act(...).
    
    When testing, code that causes React state updates should be wrapped into act(...):
    
    act(() => {
      /* fire events that update state */
    });
    /* assert on the output */
    
    This ensures that you're testing the behavior the user would see in the browser. Learn more at https://fb.me/react-wrap-tests-with-act
        in Formik

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        1.634s
Ran all test suites.
✨  Done in 2.39s.

Releases

No releases published

Packages

No packages published