File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ nav_order: 5
10
10
11
11
## main
12
12
13
+ * Register ViewComponent tests directory for ` rails stats ` .
14
+
15
+ * Javier Aranda*
16
+
13
17
* Wrap entire compile step in a mutex to make it more resilient to race conditions.
14
18
15
19
* Blake Williams*
Original file line number Diff line number Diff line change @@ -15,8 +15,14 @@ class Engine < Rails::Engine # :nodoc:
15
15
else
16
16
initializer "view_component.stats_directories" do |app |
17
17
require "rails/code_statistics"
18
- dir = ViewComponent ::Base . view_component_path
19
- Rails ::CodeStatistics . register_directory ( "ViewComponents" , dir )
18
+
19
+ if Rails . root . join ( ViewComponent ::Base . view_component_path ) . directory?
20
+ Rails ::CodeStatistics . register_directory ( "ViewComponents" , ViewComponent ::Base . view_component_path )
21
+ end
22
+
23
+ if Rails . root . join ( "test/components" ) . directory?
24
+ Rails ::CodeStatistics . register_directory ( "ViewComponent tests" , "test/components" , test_directory : true )
25
+ end
20
26
end
21
27
end
22
28
Original file line number Diff line number Diff line change @@ -7,8 +7,14 @@ namespace :view_component do
7
7
# :nocov:
8
8
require "rails/code_statistics"
9
9
10
- dir = ViewComponent ::Base . view_component_path
11
- ::STATS_DIRECTORIES << [ "ViewComponents" , dir ] if File . directory? ( Rails . root + dir )
10
+ if Rails . root . join ( ViewComponent ::Base . view_component_path ) . directory?
11
+ ::STATS_DIRECTORIES << [ "ViewComponents" , ViewComponent ::Base . view_component_path ]
12
+ end
13
+
14
+ if Rails . root . join ( "test/components" ) . directory?
15
+ ::STATS_DIRECTORIES << [ "ViewComponent tests" , "test/components" ]
16
+ CodeStatistics ::TEST_TYPES << "ViewComponent tests"
17
+ end
12
18
# :nocov:
13
19
end
14
20
end
You can’t perform that action at this time.
0 commit comments