Skip to content
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

Coverlet.withDotNetTestOptions seems not to have any effect #2423

Closed
SteveGilham opened this issue Oct 29, 2019 · 4 comments
Closed

Coverlet.withDotNetTestOptions seems not to have any effect #2423

SteveGilham opened this issue Oct 29, 2019 · 4 comments

Comments

@SteveGilham
Copy link
Contributor

SteveGilham commented Oct 29, 2019

Description

Coverlet.withDotNetTestOptions seems not to have any effect on the MSBuildParams Properties field. This happens using .net SDK 3.0.100, and Fake 5.18.2 as a local tool.

This is a weird one, which has me baffled. I don't think there's an obvious howler that I've pulled here, but the workround (below) suggests something very odd going on.

Repro steps

Run this Fake script

#r "paket:
nuget Fake.Core.Target >= 5.18.2
nuget Fake.Core.Environment >= 5.18.2
nuget Fake.Core.Process >= 5.18.2
nuget Fake.DotNet.AssemblyInfoFile >= 5.18.2
nuget Fake.DotNet.Cli >= 5.18.2
nuget Fake.DotNet.Testing.Coverlet >= 5.18.2 //"

open Fake.DotNet
open Fake.DotNet.Testing

let coverletOptions (o : Coverlet.CoverletParams) = 
  { o with OutputFormat = Coverlet.OutputFormat.OpenCover
                          Exclude = [ ("*.Tests", "*")
                                      ("*.XTests", "*")
                                      ("xunit*", "*")
                                      ("Sample*", "*")
                                      ("AltCover.Record*", "M*")
                                      ("NUnit*", "*")] }

DotNet.TestOptions.Create()
|> Coverlet.withDotNetTestOptions coverletOptions
|> printfn "%A"

do ()

Expected behavior

Output should include

  MSBuildParams =
                 { Targets = []
                   Properties =
                               [("CollectCoverage", "true");
                                ("OutputFormat", "opencover");
                                ("CoverletOutput", "./");
                                ("Exclude",
                                 "[*.Tests]*,[*.XTests]*,[xunit*]*,[Sample*]*,[AltCover.Record*]M*,[NUnit*]*")]

Actual behavior

Instead it looks like

MSBuildParams = { Targets = []
                    Properties = [] 

Known workarounds

Copying most of the Coverlet.fs source into the space between lines 10 and 12 of the above script and adding Coverlet. where necessary to make it compile.

It's as if something in withMSBuildArguments needs to be in the consuming script, but there's nothing obvious here that I can see that could be causing this behaviour.

Related information

  • Windows 10 home
  • Release 5.18.2 (fake-cli as a local tool)
  • .net core v3.0 (SDK 3.0.100)
  • the new feature is not usefully functional
@matthid
Copy link
Member

matthid commented Oct 29, 2019

This looks very strange, can you try adding a failing test for this and sending a pr?

@matthid
Copy link
Member

matthid commented Oct 29, 2019

also /cc @Tarmil just in case

@Tarmil
Copy link
Contributor

Tarmil commented Oct 29, 2019

Oh, I think I see what's going on. I'm guessing that the project is compiled with an older F# language version. The list items are added using implicit yield, which means that in F# 4.6 or older they just get ignored...

@Tarmil
Copy link
Contributor

Tarmil commented Oct 29, 2019

Although if that's the case, then I don't know how the tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants