Skip to content

Commit

Permalink
Reneable YJIT, move timeout to spec_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
kigster committed Sep 23, 2024
1 parent 3f0fbfd commit b8c54a8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ jobs:
bin/rails db:test:prepare
- name: "Run Rspec"
run: bundle exec rspec --backtrace --force-color --format documentation
run: time bundle exec rspec --backtrace --force-color --format documentation

3 changes: 2 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
--format progress
--force-color
--color
--order rand
--profile 5
--profile 3
--require rails_helper
7 changes: 0 additions & 7 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@

require 'rspec/rails'
require 'accept_values_for'
require 'timeout'

def example_with_timeout(example)
Timeout.timeout(30) { example.run }
end

RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
Expand All @@ -25,8 +20,6 @@ def example_with_timeout(example)
Ventable.enable
end

config.around { |example| example_with_timeout(example) }

config.use_transactional_fixtures = true

config.expect_with(:rspec) do |c|
Expand Down
9 changes: 4 additions & 5 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

# Enable YJIT if we have it compiled in
if defined?(RubyVM::YJIT) && RubyVM::YJIT.respond_to?(:enable)
RubyVM::YJIT.enabled? ? warn('[ 𐄂 ] YJIT is enabled') : warn('[ 𐄂 ] YJIT is disabled')
# uncomment when we determine if the spec failures are due to YJIT
# RubyVM::YJIT.enable
# puts '[ ✔ ] YJIT is enabled'
RubyVM::YJIT.enable
puts '[ ✔ ] YJIT is enabled'
else
warn '[ 𐄂 ] YJIT is not enabled'
end
Expand All @@ -29,7 +27,8 @@
end

config.around do |example|
Timeout.timeout(5) do
# 10 seconds should be more than enough for ANY spec
Timeout.timeout(ENV.fetch('RSPEC_TIMEOUT', 10).to_i) do
example.run
end
end
Expand Down

0 comments on commit b8c54a8

Please sign in to comment.