Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion rspec-trunk-flaky-tests/lib/trunk_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,21 @@ def escape(str)
str.dump[1..-2]
end

# Knapsack example detector instantiates all test cases in order to determine how to shard them
# These instantiations should not generate test bundles, so we
# disable the gem when running under knapsack_pro:rspec_test_example_detector
def knapsack_detector_mode?
knapsack_detector_command?
end

def knapsack_detector_command?
command_line = "#{$PROGRAM_NAME} #{ARGV.join(' ')}".strip
command_line.include?('knapsack_pro:rspec_test_example_detector')
end

def trunk_disabled
ENV['DISABLE_RSPEC_TRUNK_FLAKY_TESTS'] == 'true' || ENV['TRUNK_ORG_URL_SLUG'].nil? || ENV['TRUNK_API_TOKEN'].nil?
knapsack_detector_mode? || ENV['DISABLE_RSPEC_TRUNK_FLAKY_TESTS'] == 'true' ||
ENV['TRUNK_ORG_URL_SLUG'].nil? || ENV['TRUNK_API_TOKEN'].nil?
end

# we want to cache the test report so we can add to it as we go and reduce the number of API calls
Expand Down
Loading