lib/knapsack_pro/tracker.rb in knapsack_pro-2.13.0 vs lib/knapsack_pro/tracker.rb in knapsack_pro-2.14.0
- old
+ new
@@ -22,18 +22,22 @@
@start_time = now_without_mock_time.to_f
end
def stop_timer
execution_time = @start_time ? now_without_mock_time.to_f - @start_time : 0.0
- update_global_time(execution_time)
- update_test_file_time(execution_time)
+
+ if current_test_path
+ update_global_time(execution_time)
+ update_test_file_time(execution_time)
+ @current_test_path = nil
+ end
+
execution_time
end
def current_test_path
- raise("current_test_path needs to be set by Knapsack Pro Adapter's bind method") unless @current_test_path
- KnapsackPro::TestFileCleaner.clean(@current_test_path)
+ KnapsackPro::TestFileCleaner.clean(@current_test_path) if @current_test_path
end
def set_prerun_tests(test_file_paths)
test_file_paths.each do |test_file_path|
# Set a default time for test file
@@ -61,10 +65,10 @@
private
def set_defaults
@global_time = 0
@test_files_with_time = {}
- @test_path = nil
+ @current_test_path = nil
end
def update_global_time(execution_time)
@global_time += execution_time
@global_time_since_beginning += execution_time