-
-
Notifications
You must be signed in to change notification settings - Fork 740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TeamCity ImportDotCoverCoverage tests fail when running on TeamCity #766
Comments
This fixes cake-build#766 by not using System.Console directly and instead using ICakeLog and mock that during tests. * Change TeamCityProvider WriteServiceMessage to use ICakeLog instead of System.Console * Change TeamCityProviderTests to not change System.Console stream so TeamCityFixture instead has a FakeLog/ICakeLog instance * Add AggregateLogMessages method to FakeLog to get all current log entries message as a string
@devlead Hmm, why is it failing on TeamCity? I mean TheImportDotCoverCoverageMethod resets the console stream on dispose? A solution with a "mockable" output for WriteServiceMessage sounds like a less "hacky" solution though. |
@mholo65 It fails because XUnit is TeamCity aware and does a little magic so test is already within a service message basically. |
..of course, and since Console is static, we're hijacking all output. |
This fixes cake-build#766 by not using System.Console directly and instead using ICakeLog and mock that during tests. * Change TeamCityProvider WriteServiceMessage to use ICakeLog instead of System.Console * Change TeamCityProviderTests to not change System.Console stream so TeamCityFixture instead has a FakeLog/ICakeLog instance * Add AggregateLogMessages method to FakeLog to get all current log entries message as a string
This fixes cake-build#766 by not using System.Console directly and instead using ICakeLog and mock that during tests. * Change TeamCityProvider WriteServiceMessage to use ICakeLog instead of System.Console * Change TeamCityProviderTests to not change System.Console stream so TeamCityFixture instead has a FakeLog/ICakeLog instance * Add AggregateLogMessages method to FakeLog to get all current log entries message as a string
This fixes cake-build#766 by not using System.Console directly and instead using ICakeLog and mock that during tests. * Change TeamCityProvider WriteServiceMessage to use ICakeLog instead of System.Console * Change TeamCityProviderTests to not change System.Console stream so TeamCityFixture instead has a FakeLog/ICakeLog instance * Add AggregateLogMessages method to FakeLog to get all current log entries message as a string
TeamCityProvider WriteServiceMessage works directly with the Console, this isn't very "mockable", because this the TheImportDotCoverCoverageMethod hi-jacks the console stream.
This works an all build systems except TeamCity were these service messages have a meaning.
I'll shorty submit a PR with a suggested fix for this.
The text was updated successfully, but these errors were encountered: