Conversation
- Fix `status:` being ignored - Allow more options to be passed - Ensure file_path is a substring of id
08fa338 to
c47422c
Compare
| self.url = url || DEFAULT_URL | ||
| self.tracing_enabled = tracing_enabled | ||
| self.artifact_path = artifact_path | ||
| self.location_prefix = location_prefix || ENV["BUILDKITE_ANALYTICS_LOCATION_PREFIX"] |
There was a problem hiding this comment.
This matches the env var used for the same purpose in the Javascript collector.
|
|
||
| module RSpecExampleTraceHelpers | ||
| def fake_example(status:) | ||
| example = double("RSpec::Core::Example") |
There was a problem hiding this comment.
The motivation for changing this helper was due to adding some additional tests on file_path and location.
The RSpec library hook looks at the source location of the example, in this case this is the declaration location of the RSpec double method, which is usually buried somewhere obscure like /home/user/path/to/ruby/version/manager/gems/rspec-1.2.3/lib/rspec/double.rb or some such weird path, different in every build environment. This makes testing the correct path and location a little difficult.
I changed this helper to return a verifying instance_double, and additionally allowed injection of the file_path and location from the test to make testing these properties easier.
lib/buildkite/test_collector.rb
Outdated
| end | ||
| end | ||
|
|
||
| class Trace |
There was a problem hiding this comment.
This new superclass lifts some common behaviour up from each *::Trace implementation.
There was a problem hiding this comment.
Can we extract this class to lib/buildkite/test_collector/trace.rb?
c47422c to
95b7fd3
Compare
Allows a file name prefix to be set which will be prepended to `file_name` and `location` in the test results. Intended for use in monorepos where the test suite lives in a sub directory of the project. The change also DRYs some duplicate behaviour by extracting a `Trace` superclass.
95b7fd3 to
2615b50
Compare
This change adds a new
location_prefixoption. If set the specifiedlocation_prefixis prepended to thefile_nameandlocationof each test when sent to Test Engine.Example
The prefix can be set either in the
Buildkite::TestCollector.configurecall as shown above or by settingBUILDKITE_ANALYTICS_LOCATION_PREFIXin the build environment.location_prefixis supported by the RSpec, minitest, and Cucumber collector hooks.