- Open up react and react-native peer dependency versions. Thanks alexburkowskypolysign for this.
- Remove sample app from codebase (was ignored by npm anyway, so doesn't affect package.
- Update CircleCI workflow.
- Fix bug in
generateTestHook
, preserving the functionality of users' own refs created usinguseRef
andcreateRef
. Thanks to MrLoh for the fix.
BREAKING This release includes updates to the default Cavy reporter to support new cavy-cli features. These changes are backwards compatible within Cavy itself, and require no changes to your code. However, if you're using cavy-cli you'll need to upgrade to version cavy-cli 2.0 to continue to run your tests.
The updated default reporter now:
- Opens a websocket connection to cavy-cli when your app boots. cavy-cli waits for a configurable length of time to receive this connection and exits with an error code if no connection is made.
- Sends in-progress results to cavy-cli, so that you can see a log of each test as they pass/fail in realtime.
This release also:
- Adds a deprecation warning if an old-style reporter is used i.e. a reporter that is a function taking one argument (the test report object).
- Remove tester app from package.
- Add ability to tag and filter tests, allowing you to run a subset of tests per test run.
- Add
fullResults
to Cavy's test report object, containing more details about the test suite and individual test cases e.g. timings and test describe block labels. Cavy can now support outputting JUnit compatible test reports via cavy-cli.
- Fix bug in
containsText
helper function, whereby you couldn't test for a component containing a number. Thank you Zooheck!
- New
focus
spec helper function. Thanks Austin!
- Extend
wrap
functionality so that it can also be used turn native components likeText
into testable components. - New
containsText
spec helper function. - Use hoist-non-react-statics
in
hook
HOC. - Add a
displayName
to thehook
HOC for ease of debugging. - Upgrade React Native in the sample app to 0.59.9.
- BREAKING Fixed issue whereby props were being flattened on
wrap
-ped function components. This is a breaking change for those users manually fetching a component and accessing a flattened prop as a workaround. All props are now accessible through theprops
key as expected. Thanks to FLGMwt for your help!
- Fix regression introduced in 2.2.0.
- Add support for passing refs created via
React.createRef
togenerateTestHook
.
- Fix confusing messaging when Cavy fails to connect to cavy-cli.
- Deprecate the
sendReport
prop. By default Cavy checks to see whether cavy-cli is running and sends the test report if a response is received. - Add the ability to use a custom
reporter
when running Cavy tests. If supplied, Cavy will send the test report to the custom reporter rather than cavy-cli.
- Add a
beforeEach
function that can be used on a per-spec basis. Thanks to PatrickBRT whose work inspired our approach! - BREAKING Clear AsyncStorage and re-render the app before each test runs.
- Cavy no longer resets your app at the end of the test suite.
- Un-deprecate
wrap
(was deprecated in 0.6.0) and rewrite it using React Hooks.wrap
is now the accepted way to test function components, replacing our previous recommendation to use Recompose'stoClass
(which has been deprecated in favour of React Hooks). 🎉
- BREAKING Drop official support for React Native < 0.59 and React < 16.8.0.
- Update
<Tester>
to use the newer Context API introduced in React 16.3. - Added a custom React Hook called
useCavy()
which can be used to accessgenerateTestHook
from your functional components.
This version brings Cavy in line with how people use React nowadays (moving towards using functional components). However React Hooks were added in React Native 0.59 and React 16.8.0, so you will need to upgrade your application to continue to use Cavy from version 1.0.0 onwards. You can continue to use 0.6.2 in the meantime.
If you don't use useCavy()
Cavy 1.0.0 should work with React Native >= 0.57.5
which was the earliest version that supported the new Context API
however this is not officially supported.
- Fix for when
clearAsyncStorage
option is used but there are no entries in AsyncStorage. Thanks haikyuu!
- Update
babel-presets-env
and.babelrc
. Thanks eriben.
- Remove
console.warn
when overwriting a component. - Add deprecation message when calling
wrap
.
- Support cavy-cli.
cavy-cli is the next step in Cavy's development. With it, we can start to support Continuous Integration, conditionally running tests, and a bunch of other cool stuff. Thanks to Tyler Pate whose suggestions inspired our approach.
- Stop using deprecated
PropTypes
andcreateClass
. Thanks Mohammed Abu-alsaad! - Fix for when using a wrapped component in a shallow render environment. Thanks Kye Bracey!
- Updated documentation for Create React Native App / Expo.
- Add optional
startDelay
property to<Tester>
which delays the test suite from beginning once the component is mounted. - Added a start and end console log line.
With thanks to Tyler Pate for both of these features!
- Tweak to the test failure message.
- Added the ability to automatically clear the app's entire AsyncStorage between test cases. By default, behaviour is unchanged (it does not clear it).
- Added a
notExists
component assertion.
- Added a pause function.
- Configurable wait time when finding components.
- Bug fix to ensure that default props are set for wrapped components.
- Initial release.