score:2
Accepted answer
With some help from the cypress community, it seems as though the react-testing-library is adding the after each hook for clean up.
https://github.com/testing-library/react-testing-library/blob/master/src/index.js
This is an async method which results in cypress giving a warning :
cypress_runner.js:85235 Cypress Warning: Cypress detected that you returned a promise in a test, but also invoked one or more cy commands inside of that promise.
I was able to prevent this addition of the afterEach and get the tests working. We can use any one of the methods given here to achieve this.
Source: stackoverflow.com
Related Query
- Unit tests fail with error "Cypress command timeout of '4000ms' exceeded."
- setupProxy file in CRA makes react-scripts start fail with Command failed with exit code 1 error
- When to use act() in jest unit tests with react-dom
- Jest "No tests found, exiting with code 1" error on Windows 10 in React Redux application
- How can I enable react-i18n translation file to be used in the unit tests done with react-testing-library and jest?
- Can't deploy React Project. Error is Command failed with exit code 1
- yarn test: all tests passed but returned "error Command failed with exit code 1"
- How to fix 'The command "npm install" exited with code 1' error when building the ASP.NET Core app with React?
- Karma/Jasmine tests fail with error: 'Uncaught Error: Module name "simple_test.js" has not been loaded yet for context: _. Use require([])'
- URLSearchParams is not defined error when running tests with jest
- How to mock the formik useFormikContext hook when writing unit tests with jest
- Coverage report for jest unit tests not displaying with --coverage option
- How to use localStorage in unit tests with Chai
- VSCode How do I debug with es6 mocha unit tests and jsx files
- Still getting "React state update on an unmounted component" error with React Testing Library tests
- Running ES2016 unit tests with Jest in BitBucket's Pipelines
- How can we run jest unit tests along with npm start or npm build?
- Error in unit testing with Jest after updating to npm 3.3.12
- React error with create-react-app command
- Action Cable error Could not execute command from...RuntimeError - Unable to find subscription with identifier
- Need do write unit tests with jest for react app, that uses okta, but getting warning
- React unit tests with Enzyme don't re-bind context of helper functions
- 'The command "npm install" exited with code 1' error when building an ASP.NET Core app with React on macOS
- running cypress test cases with assertion expect(xhr.requestBody.test).to.not.exist, but eslint throws error
- Error with React Stripe split card elements: Maximum update depth exceeded
- Cypress type error when given string returned from cypress command
- Error when Using Custom React Hook in a Multi-Module Project for Tests with Jest
- electron with react error bin sh build command not found
- Unit testing error with act and useState, Making an API call in useEffect
- Typescript error in ReactJS tests with React Testing Library
More Query from same tag
- Passed prop from child to parent not working (React)
- React and CSS gauge progress. SVG circular path length
- How to show a count down/up in react
- How to refactor to prevent component from losing its previous state (ReactJS)?
- Prevent embedding small assets into HTML file
- How to render svg icons in react
- Reducer not receiving action in redux or trouble with the action being called
- How to implement Controlled Components (in ReactJS) using Vanilla JavaScript or JQuery
- testcafe selector does not find 'div' elements
- Dynamic import of react hooks
- Cannot import Firebase Firestore Colletion
- How to implement like and unlike buttons in a react app using firebase
- Import SASS variables into Material UI theme with NextJS
- React map function if else condition
- React.js input cursor reset with async onChange handler
- Newbie react question: Target container is not a DOM element when calling react from html
- styled components change style based on class without props
- Enable Zoom on an ESNet react-timeseries-charts Chart
- React dynamically mutating a state list async problem
- Next JS Returned Element Does Not Apply CSS
- How to abort running async/await xmlHttpRequest within componentWillUnmount?
- Different colors for different h1 titles in differents components with React
- Pass setState from useState() hook using <Link>
- React: [Label]-[input]-[edit btn]-[save btn-(hidden)]
- Lit element object property is undefined
- Upload image using react to active storage rails
- useEffect not triggering re-render when it's being used with useReducer
- how to resolve promise pending from async function within express get call
- Update state from axios call in useEffect hook
- Best way to split strings?