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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Jest #981

Merged
merged 2 commits into from
May 11, 2017
Merged

Use Jest #981

merged 2 commits into from
May 11, 2017

Conversation

gillesdemey
Copy link
Contributor

Inspired by #926, fixes #703 and partially addresses #559

As I understand the consensus seems to be:

  • Use Jest
  • Prefer assert
  • Keep using supertest@3

I used Promises / async where it made most sense and where it simplified the tests.

I'm using --forceExit because some tests do not properly close app.listen, I don't think it's that big of a deal and the current test suite has the same behaviour.

Haven't focused on making the benchmarks work cross-platform, might send a PR in the future to use autocannon instead of wrk (although wrk is fine for me, it seems some folks are concerned about the Windows platform).

@codecov
Copy link

codecov bot commented May 8, 2017

Codecov Report

Merging #981 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #981    +/-   ##
======================================
  Coverage     100%   100%            
======================================
  Files           4      5     +1     
  Lines         431    356    -75     
  Branches      102      0   -102     
======================================
- Hits          431    356    -75
Impacted Files Coverage Δ
lib/context.js 100% <0%> (ø) ⬆️
lib/application.js 100% <0%> (ø) ⬆️
lib/response.js 100% <0%> (ø) ⬆️
lib/request.js 100% <0%> (ø) ⬆️
test/helpers/context.js 100% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 13c7ca6...91ed4ce. Read the comment docs.

@dead-horse
Copy link
Member

great work!

@robinpokorny
Copy link
Contributor

@gillesdemey, I was just wondering, what are the arguments for assert? In the issues you linked, I could not find it.

@gillesdemey
Copy link
Contributor Author

@gillesdemey gillesdemey deleted the feature/jest branch October 12, 2017 10:56
@robinpokorny
Copy link
Contributor

@gillesdemey Oh, I meant in comparison to expect that comes with Jest.

Full disclosure, I really like the new .resolves/.rejects matchers for async code. I was about to check if it is used here and create a PR otherwise. But found out that we use assert everywhere. It this PR, it says ‘Prefer assert’ and I could not find the reasons for it written anywhere.

@gillesdemey
Copy link
Contributor Author

assert has a much simpler interface, contrasted to expect's more readable style.

I believe @jonathanong has stated his preference for assert a few time before but it ultimately comes down to personal preference :)

#926 (review)
#926 (review)

@robinpokorny
Copy link
Contributor

@gillesdemey OK, thanks. That's what I wanted to find out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch to a new testing system
3 participants