RSpec profiling: Track spec file where example groups were used
What does this MR do and why?
Prior this commit RSpec Profiling tracked the file location where the example was called. This location could be a shared example. This made most commonly used shared examples to be shown on top.
This commit uses the spec location where (deeply nested) shared examples are used. Now, spec files will shown instead.
Screenshots or screen recordings
https://gitlab-org.gitlab.io/rspec_profiling_stats/ |
---|
How to set up and validate locally
For example, spec/requests/api/pypi_packages_spec.rb
a mix of in-place examples and shared examples use.
master
RSPEC_PROFILING_FOLDER_PATH=`pwd`/tmp/ CI_JOB_NAME=before RSPEC_PROFILING=1 bin/rspec spec/requests/api/pypi_packages_spec.rb
...
cut -d "," -f 4 tmp/before-*.csv | sort | uniq -c
1 file
3 ./spec/requests/api/pypi_packages_spec.rb
71 ./spec/support/shared_examples/requests/api/packages_shared_examples.rb
86 ./spec/support/shared_examples/requests/api/pypi_packages_shared_examples.rb
262 ./spec/support/shared_examples/requests/response_status_shared_examples.rb
4 ./spec/support/shared_examples/services/packages_shared_examples.rb
Most of the examples were attributes to shared examples, which isn't useful in context of https://gitlab-org.gitlab.io/rspec_profiling_stats/.
This MR
RSPEC_PROFILING_FOLDER_PATH=`pwd`/tmp/ CI_JOB_NAME=after RSPEC_PROFILING=1 bin/rspec spec/requests/api/pypi_packages_spec.rb
...
cut -d "," -f 4 tmp/after-*.csv | sort | uniq -c
1 file
426 ./spec/requests/api/pypi_packages_spec.rb
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Leitzen