-
Drop support for Ruby <2.7 and Rails <6.
-
FactoryDefault: Add
#get_factory_default
. [@john-h-k] -
Add variations information to FactorProf reports. (@lHydra)
Get info on traits/overrides used by running FPROF=1 FPROF_VARS=1 <your test command>
.
-
Add support for
report_duplicates
config option forlet_it_be
(@lHydra) -
Support latest Timecop patching
Process.clock_gettime
. (@palkan) -
Vernier: Add hooks configuration parameter. (@lHydra)
Now you can add more insights to the resulting report by adding event markers from Active Support Notifications.
To do this, specify the TEST_VERNIER_HOOKS=rails
env var or set it through Vernier
configuration:
TestProf::Vernier.configure do |config|
config.hooks = :rails
end
- FactoryProf: Add threshold configuration parameter. (@lHydra)
Now you can ignore factories which total number of calls is less than the provided threshold. To do this, specify
the FPROF_THRESHOLD=30
env var or set it through FactoryProf
configuration:
TestProf::FactoryProf.configure do |config|
config.threshold = 30
end
- Fix MemProf bugs. (@palkan)
- Add Minitest support for TagProf. (@lioneldebauge)
- Add support for dumping FactoryProf results in JSON format. (@uzushino)
-
Add Vernier integration. (@palkan)
-
StackProf uses JSON format by default. (@palkan)
-
MemoryProf ia added. (@Vankiru)
- Minor fixes and dependencies upgrades.
- Ignore inaccessible connection pools in
before_all
. (@bf4)
See #267.
-
Fix regression with
before_all(setup_fixtures: true)
andrspec-rails
v6.0+. (@palkan) -
Upgrade to RubyProf 1.4+. (@palkan)
- Add support for multiple databases to
before_all
/let_it_be
with Active Record. (@rutgerw)
-
LetItBe: freeze records during initialization with
freeze: true
. (@palkan) -
Add FactoryDefault profiler (factory associations profilers). (@palkan)
-
FactoryDefault: Allow creating a default per trait (or set of traits). (@palkan)
Now create_default(:user)
and create_default(:user, :admin)
would result into two defaults corresponding to the specified traits.
- FactoryDefault: Add stats support. (@palkan)
Now you can see how often the default factory values have been used by specifying
the FACTORY_DEFAULT_SUMMARY=1
or FACTORY_DEFAULT_STATS=1
env var.
- Support using FactoryDefault with before_all/let_it_be. (@palkan)
Currently, RSpec only. Default factories created within before_all
or let_it_be
are not reset 'till the end of the corresponding context. Thus, now it's possible to use create_default
within let_it_be
without any additional hacks.
- FactoryDefault: Add
preserve_attributes = false | true
option. (@palkan)
Allow skipping defaults if association is defined with overrides, e.g.:
factory :post do
association :user, name: "Post Author"
end
- FactoryDefault: Add
skip_factory_default(&block)
to temporary disable default factories. (@palkan)
You can also use TestProf::FactoryDefault.disable!(&block)
.
- Add support for global
before_all
tags (@maxshend)
TestProf::BeforeAll.configure do |config|
config.before(:begin, reset_sequences: true, foo: :bar) do
warn <<~MESSAGE
Do NOT create objects outside of transaction
because all db sequences will be reset to 1
in every single example, so that IDs of new objects
can get into conflict with the long-living ones.
MESSAGE
end
end
-
Fix monitoring methods with keyword args in Ruby 3+. (@palkan)
-
Disable garbage collection frames when
TEST_STACK_PROF_IGNORE_GC
env variable is set (@cbliard) -
Fixed restoring lock_thread value in nested contexts (@ygelfand)
- Allow overriding global logger. (@palkan)
require "test_prof/recipes/logging"
TestProf::Rails::LoggingHelpers.logger = CustomLogger.new
-
Add
AnyFixture.before_fixtures_reset
andAnyFixture.after_fixtures_reset
callbacks. (@ruslanshakirov) -
Fixes ActiveRecord 6.1 issue with AnyFixture and Postgres config (@markedmondson)
-
Restore the lock_thread value after rollback. (@cou929)
-
Fixes the configuration of a printer for factory_prof runs
-
Ensure that defaults are stored in a threadsafe manner
-
Fix access to
let_it_be
variables inafter(:all)
hook. (@cbarton) -
Add support for using the before_all hook with Rails' parallelize feature (using processes). (@peret)
Make sure to include TestProf::BeforeAll::Minitest
before you call parallelize
.
-
Fix Spring detection when
DISABLE_SPRING=1
is used. (@palkan) -
Make
before_all
in Minitest inheritable. (@palkan)
- Fix logging regression when no newline has been added. (@palkan)
- Add ability to use custom logger. (@palkan)
TestProf.configure do |config|
config.logger = Logger.new($stdout, level: Logger::WARN)
end
- Add
nate_heckler
mode for FactoryProf. (@palkan)
Drop this into your rails_helper.rb
or test_helper.rb
:
require "test_prof/factory_prof/nate_heckler"
And for every test run see the overall factories usage:
[TEST PROF INFO] Time spent in factories: 04:31.222 (54% of total time)
- Minor fixes.
- Make
before_all(setup_fixtures: true)
compatible with Rails 6.1. (@palkan)
- Fixed AnyFixture deprecation warning.
- Make Rails fixtures accessible in
before_all
. (@palkan)
You can load and access fixtures when explicitly enabling them via before_all(setup_fixtures: true, &block)
.
-
Minitest's
before_all
is not longer experimental. (@palkan) -
Add
after_all
to Minitest in addition tobefore_all
. (@palkan)
-
Remove deprecated
AggregateFailures
cop. (@palkan) -
Remove
ActiveRecordSharedConnection
. (@palkan) -
Add
AnyFixture#register_dump
to cache fixtures using SQL dumps. (@palkan) -
Replaced
TestProf::AnyFixture.reporting_enabled = true
withTestProf::AnyFixture.config.reporting_enabled = true
. (@palkan) -
Add support for RSpec aliases detection when linting specs using
let_it_be
/before_all
withrubocop-rspec
2.0 (@pirj)
- Execute Minitest
before_all
in the context of the current test object. (@palkan)
- Minor improvements.
-
Add state leakage detection for
let_it_be
. (@pirj, @jaimerson, @alexvko) -
Add default let_it_be modifiers configuration. (@palkan)
You can configure global modifiers:
TestProf::LetItBe.configure do |config|
# Make refind activated by default
config.default_modifiers[:refind] = true
end
Or for specific contexts via tags:
context "with let_it_be reload", let_it_be_modifiers: {reload: true} do
# examples
end
-
Drop Ruby 2.4 support. (@palkan)
-
SAMPLE and SAMPLE_GROUP work consistently with seed in RSpec and Minitest. (@stefkin)
-
Make sure EventProf is not affected by time freezing. (@palkan)
EventProf results now is not affected by
Timecop.freeze
or similar.See more in #181.
-
Adds the ability to define stackprof interval sampling by using
TEST_STACK_PROF_INTERVAL
env variable (@LynxEyes)Now you can use
$ TEST_STACK_PROF=1 TEST_STACK_PROF_INTERVAL=10000 rspec
to define a custom interval (in microseconds).
- Disable
RSpec/AggregateFailures
by default. (@pirj)
- Fix RuboCop integration regressions. (@palkan)
- Add
config/
to the gem contents. (@palkan)
Fixes RuboCop integration regression from 0.11.0.
-
Fix
let_it_be
issue when initialized with an array/enumerable or an AR relation. (@pirj) -
Improve
RSpec/AggregateExamples
(formerlyRSpec/AggregateFailures
) cop. (@pirj)
- Fix Ruby 2.7 deprecations. (@lostie)
-
Fix AnyFixture DSL when using with Rails 6.1+. (@palkan)
-
Fix loading
let_it_be
without ActiveRecord present. (@palkan) -
Fix compatibility of
before_all
withisolator
gem to handle correct usages of non-atomic interactions outside DB transactions. (@Envek) -
Updates FactoryProf to show the amount of time taken per factory call. (@tyleriguchi)
- Use RSpec example ID instead of full description for RubyProf/Stackprof report names. (@palkan)
For more complex scenarios feel free to use your own report name generator:
# for RubyProf
TestProf::RubyProf::Listener.report_name_generator = ->(example) { "..." }
# for Stackprof
TestProf::StackProf::Listener.report_name_generator = ->(example) { "..." }
- Support arrays in
let_it_be
with modifiers. (@palkan)
# Now you can use modifiers with arrays
let_it_be(:posts, reload: true) { create_pair(:post) }
- Refactor
let_it_be
modifiers and allow adding custom modifiers. (@palkan)
TestProf::LetItBe.config.register_modifier :reload do |record, val|
# ignore when `reload: false`
next record unless val
# ignore non-ActiveRecord objects
next record unless record.is_a?(::ActiveRecord::Base)
record.reload
end
- Print warning when
ActiveRecordSharedConnection
is used in the version of Rails supportinglock_threads
(5.1+). (@palkan)
- Add threshold and custom event support to FactoryDoctor. (@palkan)
FDOC=1 FDOC_EVENT="sql.rom" FDOC_THRESHOLD=0.1 rspec
-
Add Fabrication support to FactoryDoctor. (@palkan)
-
Add
guard
andtop_level
options toEventProf::Monitor
. (@palkan)
For example:
TestProf::EventProf.monitor(
Sidekiq::Client,
"sidekiq.inline",
:raw_push,
top_level: true,
guard: ->(*) { Sidekiq::Testing.inline? }
)
- Add global
before_all
hooks. (@danielwaterworth, @palkan)
Now you can run additional code before and after every before_all
transaction
begins and rollbacks:
TestProf::BeforeAll.configure do |config|
config.before(:begin) do
# do something before transaction opens
end
config.after(:rollback) do
# do something after transaction closes
end
end
- Add ability to use
let_it_be
aliases with predefined options. (@danielwaterworth)
TestProf::LetItBe.configure do |config|
config.alias_to :let_it_be_with_refind, refind: true
end
- Made FactoryProf measure and report on timing (@danielwaterworth)
See changelog for versions <0.9.0.