Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert test suite to Jest #1944

Closed
timdorr opened this issue Sep 12, 2016 · 3 comments
Closed

Convert test suite to Jest #1944

timdorr opened this issue Sep 12, 2016 · 3 comments

Comments

@timdorr
Copy link
Member

timdorr commented Sep 12, 2016

Since we now recommend using Jest, we should practice what we preach 馃槃

Jest 15 introduces some major improvements and makes the TDD process a heck of a lot easier and more fun. It's also faster and and has more helpful error messages. It's really awesome and there's good reason for its recommendation in the Writing Tests docs.

This is a request for a PR from the community. If you want to help out with open source development, this is a great chance to do so. Just remove mocha (the current test runner) and expect (Jest provides an expect function built-in), and switch out the test suite to run through Jest instead. There are hopefully only minimal changes needed to the actual test code, so this should mostly be just simple infrastructure work.

It should be good for beginners, but let us know if anything is particularly challenging. We can pass that along to the Jest team, who is always looking for ways to make the tool as friendly and fun as possible.

@jimbolla
Copy link
Contributor

I was going to suggest the same thing

@HeinrichFilter
Copy link
Contributor

I am keen to give it a try.

It will be my first contribution to a popular project. Please feel free to point out mistakes or anything that can be done better/differently.

HeinrichFilter added a commit to HeinrichFilter/redux that referenced this issue Sep 13, 2016
Added Jest dependencies
Removed expect from files
Updated mocks to use `jest.fn()`
Current `expect.spyOn` replacement can be improved on
TODO: Fix linter not to complain about using `console`
HeinrichFilter added a commit to HeinrichFilter/redux that referenced this issue Sep 13, 2016
While looking into reduxjs#1944 I noticed that the examples in the documentation
still uses expect's createSpy() instead of Jest's fn() approach
HeinrichFilter added a commit to HeinrichFilter/redux that referenced this issue Sep 13, 2016
Added Jest dependencies
Removed expect from files
Updated mocks to use `jest.fn()`
Current `expect.spyOn` replacement can be improved on
TODO: Fix linter not to complain about using `console`
@timdorr
Copy link
Member Author

timdorr commented Sep 13, 2016

Thanks @HeinrichFilter!

gaearon pushed a commit that referenced this issue Sep 21, 2016
* Fix Jest spy code in documentation

While looking into #1944 I noticed that the examples in the documentation
still uses expect's createSpy() instead of Jest's fn() approach

* #1944 Converting tests from Mocha to Jest

Added Jest dependencies
Removed expect from files
Updated mocks to use `jest.fn()`
Current `expect.spyOn` replacement can be improved on
TODO: Fix linter not to complain about using `console`

* Disable eslint no-console for console related tests

* Made changes suggested by @Florian-R that enable no-args jest.fn() calls

https://github.com/reactjs/redux/pull/1951/files/927bf45f1c7666e42ae8c4c390cc726a75cab903#r78733124

* Removed moch, expect and isparta

Updated test:cov command to use jest's --coverage option

* Update typescript.spec.js
@timdorr timdorr closed this as completed Sep 27, 2016
seantcoyote pushed a commit to seantcoyote/redux that referenced this issue Jan 14, 2018
* Fix Jest spy code in documentation

While looking into reduxjs#1944 I noticed that the examples in the documentation
still uses expect's createSpy() instead of Jest's fn() approach

* reduxjs#1944 Converting tests from Mocha to Jest

Added Jest dependencies
Removed expect from files
Updated mocks to use `jest.fn()`
Current `expect.spyOn` replacement can be improved on
TODO: Fix linter not to complain about using `console`

* Disable eslint no-console for console related tests

* Made changes suggested by @Florian-R that enable no-args jest.fn() calls

https://github.com/reactjs/redux/pull/1951/files/927bf45f1c7666e42ae8c4c390cc726a75cab903#r78733124

* Removed moch, expect and isparta

Updated test:cov command to use jest's --coverage option

* Update typescript.spec.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants