Thanks for being willing to contribute!
Working on your first Pull Request? You can learn how from this little video How to Contribute to an Open Source Projects
- Fork and clone the repo
npm install
to install dependenciesnpm run test:watch
to validate you've got it working while working!- Create a branch for your PR
- All changes should have unit tests
- Any relevant documentation should be updated
- No linting warnings/errors should be introduced
- Each matcher should be placed in it's own file inside of the
matchers
directory. - A matcher should export an object with two properties
symmetric
andasymmetric
which should contain the following:symmetric
should contain a function that returns {pass, message} like the Jest API specifies with the same name as the symmetric matcherasymmetric
- Should export a class that has same name as asymmetric matcher which:- has the property
$$typeof
===Symbol.for("jest.asymmetricMatcher")
- its constructor must accept both
expected
andinverse
(boolean). - Finally it needs to implement a
asymmetricMatch
method that receivereceived
arguments and compares and inverses if necessary - Optional but highly recommended:
toAsymmetricMatcher
allows the matcher to customize the output that will be displayed - Sadly the above isn't really documented in Jest yet so hopefully this helps out, feel free to message me or open an issue with questions!
- has the property
jest-matchers-utils
is being used for syntax highlighting of error messages.- See the Jest docs for an example usage
lodash
is being used for most comparison logic.
Once you are ready to commit the changes, please use the below commands
git add <files to be committed>
git commit -m 'A meaningful message