Skip to content

Instantly share code, notes, and snippets.

@SteveGilham
Created November 16, 2022 16:01
Show Gist options
  • Save SteveGilham/ffab967daa1402440a562c771c73a5eb to your computer and use it in GitHub Desktop.
Save SteveGilham/ffab967daa1402440a562c771c73a5eb to your computer and use it in GitHub Desktop.
// do any required customizations here
var altcoverSettings = new AltCover.Cake.CoverageSettings {
PreparationPhase = new TestPrepareOptions(),
CollectionPhase = new TestCollectOptions(),
Options = new TestOptions()
};
var testSettings = new DotNetCoreTestSettings {
Configuration = configuration,
NoBuild = true,
};
// It should just be like this to mix-in the AltCover coverage settings explicitly
// testSettings.ArgumentCustomization = altcoverSettings.Concatenate(testSettings.ArgumentCustomization);
// SDK v7.0.100 needs this instead
var args = AltCover.DotNet.ToTestArgumentList(
altcoverSettings.PreparationPhase,
altcoverSettings.CollectionPhase,
altcoverSettings.Options).ToArray();
Array.ForEach(args,
s => { var bits = s.Substring(3).Split('=', StringSplitOptions.RemoveEmptyEntries);
testSettings.EnvironmentVariables[bits[0]] = bits[1].Trim('"');});
// test using the default alias
DotNetTest("./_DotnetTest/cake_dotnettest.fsproj", testSettings);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment