This repository was archived by the owner on Nov 30, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 753
WIP Refactor group profile to include beforehook #1942
Closed
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
744baf5
WIP Refactor group profile to include beforehook -- todo : fix json…
denislaliberte 28d5d5c
remove blank line
denislaliberte 829b0c8
rename profile_group
denislaliberte 149ca22
Merge branch 'master' into issue-1878-wip-7
denislaliberte 52a9a2a
merge
denislaliberte 283f141
rename group to notification and add comment to remind to use group.id
denislaliberte fe7ffad
update profile group features
denislaliberte eecfa2b
fix typo
denislaliberte 2ad94da
Merge branch 'master' into issue-1878-wip-8
denislaliberte 9a8cd1b
count exmaple in group in event WIP
denislaliberte 8ad2170
remove loop over the examples, use event instead
denislaliberte 22cb21a
move feature to profile.feature
denislaliberte 2d53306
update comments
denislaliberte 1ef7356
use groups instead og group id and add comments
denislaliberte e47a1f3
fallback on id, need to to more test with object instance
denislaliberte 74141ee
sort and first on group example
denislaliberte 88783f9
tag event method as provate
denislaliberte 2323e11
remove debug pust
denislaliberte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -577,24 +577,8 @@ def percentage | |
end | ||
|
||
# @return [Array<RSpec::Core::Example>] the slowest example groups | ||
def slowest_groups | ||
@slowest_groups ||= calculate_slowest_groups | ||
end | ||
|
||
private | ||
|
||
def calculate_slowest_groups | ||
example_groups = {} | ||
|
||
examples.each do |example| | ||
location = example.example_group.parent_groups.last.metadata[:location] | ||
|
||
location_hash = example_groups[location] ||= Hash.new(0) | ||
location_hash[:total_time] += example.execution_result.run_time | ||
location_hash[:count] += 1 | ||
next if location_hash.key?(:description) | ||
location_hash[:description] = example.example_group.top_level_description | ||
end | ||
# todo rename this method or move it's code to the json_formater.rb and profile.formater.rb | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code shouldn't be moved to the formatters, it should be de-duplicated here. |
||
def calculate_slowest_groups(example_groups) | ||
|
||
# stop if we've only one example group | ||
return {} if example_groups.keys.length <= 1 | ||
|
@@ -607,6 +591,7 @@ def calculate_slowest_groups | |
end | ||
end | ||
|
||
|
||
# The `DeprecationNotification` is issued by the reporter when a deprecated | ||
# part of RSpec is encountered. It represents information about the | ||
# deprecated call site. | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic you've added to these methods should be moved elsewhere, either to the notifications or to the reporter that generates them so that we're not repeating the logic (and so eventually other formatters can make use of it if they want to)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I find how to register to these events on the ProfileNotification, I start a new branch where I don't need to change to the formatter.