You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However Dir.glob("test/unit/**/*_test.rb").sort.each { |f| require "./" + f } does not actually "test" pagy. It only runs all tests files in sorted order, which - when running that way - covers only a quite reduced subset of the cases we must cover.
This is what actually ensures that the API fully works. And this ensures that the API is 100% covered, that the E2E is fine on the client side, and that the code is following the best practices and the pagy standards (rubocop).
Preparing a rake test, (covering all we need, the way we need it) would be quite cumbersome and painful. That's why we use Thor, which simplify the code and maintenance. You can run thor test:all to actually run what you would expect the rake task would run. (see this README for details)
thor test:all output
As you can see the units that your rake test run are roughly half of what we need to run (just for the API):
/usr/bin/zsh -c "bundle exec thor test:all"
Inspecting 200 files
.....................................................................................................
...................................................................................................
200 files inspected, no offenses detected
Testing the CURRENT API...
Started with run options --seed 48225
570/570: [====================================================] 100% Time: 00:00:00, Time: 00:00:00
Finished in 0.54893s
570 tests, 1667 assertions, 0 failures, 0 errors, 0 skips
Testing the NEXT API...
Started with run options --seed 36839
560/560: [====================================================] 100% Time: 00:00:00, Time: 00:00:00
Finished in 0.52270s
560 tests, 1628 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for CURRENT_API, NEXT_API to /home/dd/repos/dd/pagy/coverage.
Line Coverage: 100.0% (1414 / 1414)
Branch Coverage: 100.0% (399 / 399)
Testing E2E apps...
Started with run options --seed 64863
19/19: [======================================================] 100% Time: 00:00:13, Time: 00:00:13
Finished in 13.24284s
19 tests, 1217 assertions, 0 failures, 0 errors, 0 skips
Process finished with exit code 0
HTH
Thank you again for your interest in improving pagy!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The root [Rakefile:1-12] previously only loaded the Thor tasks, so [rake test] completed without running any tests.
Added Bundler setup and a dedicated [test] task that executes the full unit suite under [gem/lib:test].
Set [test] as the default Rake task so the conventional command now behaves as expected.
Verified the change by running [rake test] the full suite passes with 562 tests and 0 failures.