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

Fix breaking change of execution order on TestTask #368

Merged
merged 1 commit into from
Dec 21, 2020

Conversation

ysakasin
Copy link
Contributor

@ysakasin ysakasin commented Dec 20, 2020

Due to #357, execution order on Rake 13.0.2 changes from Rake 13.0.1.

Example:

Rake::TestTask do |t|
  t.test_files = [
    "test/a.rb",
    "test/b.rb",
  ]
end

On 13.0.2, Rake executes test/b.rb before test/a.rb because test/a.rb are loaded before rake_test_loader.rb.
rake_test_loader.rb executes the Ruby code in ARGV using Kernel.#require, but does not execute test/a.rb which is already loaded.

In addition, Rake 13.0.1 allows specifying test_files without .rb but 13.0.2 doesn't allows.
This commit also fixes this problem.

Rake::TestTask do |t|
  t.test_files = [
    "test/setup",
    "test/a.rb",
  ]
end

Due to ruby#357, execution order on Rake 13.0.2 changes from Rake 13.0.1.

Example:
```
Rake::TestTask do |t|
  t.test_files = [
    "test/a.rb",
    "test/b.rb",
  ]
end
```

On 13.0.2, Rake executes test/b.rb before test/a.rb because test/a.rb are loaded before rake_test_loader.rb.
rake_test_loader.rb executes the Ruby code in ARGV using Kernel.#require, but does not execute test/a.rb which is already loaded.

In addition, Rake 13.0.1 allows specifying test_files without .rb but 13.0.2 doesn't allows.
This commit also fixes this problem.
```
Rake::TestTask do |t|
  t.test_files = [
    "test/setup",
    "test/a.rb",
  ]
end
```
@mattbrictson
Copy link

Thanks for finding this! rake test for all of my projects has started failing with rake 13.0.2. I tried the branch referenced in this PR and it fixes the problem. ❤️

I hope this gets merged soon.

@hsbt
Copy link
Member

hsbt commented Dec 21, 2020

@ysakasin Thanks to your report and patch. I merged it and release rake-13.0.3 now. Can you confirm to fix your issue with rake-13.0.3?

@mattbrictson Also confirm it with rake-13.0.3?

@mattbrictson
Copy link

@hsbt confirmed, it is fixed in rake-13.0.3. Thanks!

@ysakasin
Copy link
Contributor Author

@hsbt I confirmed to fix my issue with rake-13.0.3. Thank you merging and releasing!

@evgeni
Copy link

evgeni commented Dec 21, 2020

Thanks! 13.0.3 also fixes the test issues we've been seeing in our environment.

Would it be a good idea to yank 13.0.2 from Rubygems so that users don't accidentally install it?

@deivid-rodriguez
Copy link
Contributor

Apologies for the unintentional breaking change and thanks @ysakasin for the quick fix, @hsbt for the quick release and @mattbrictson for the quick testing ❤️.

@evgeni No, that's not a good idea. The use case for yanking a gem is if someone stole your credentials and pushed a malicious version of your gem, or if you accidentally pushed sensitive data together with your gem, or things like that. Yanking a gem has bad consequences on lockfiles locked to the yanked version and in general is not recommended for deleting gems that have bugs. Imagine if every gem that has a bug needed to be yanked, we'd be wiping out the whole rubygems.org DB 🤣.

This was referenced Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants