@@ -52,11 +52,6 @@ let distDir = rootDirectory </> "dist"
5252
5353let distGlob = distDir </> " *.nupkg"
5454
55- let coverageThresholdPercent = 0
56-
57- let coverageReportDir = rootDirectory </> " docs" </> " coverage"
58-
59-
6055let docsDir = rootDirectory </> " docs"
6156
6257let docsSrcDir = rootDirectory </> " docsSrc"
@@ -93,8 +88,6 @@ let mutable changelogBackupFilename = ""
9388
9489let publishUrl = " https://www.nuget.org"
9590
96- let enableCodeCoverage = environVarAsBoolOrDefault " ENABLE_COVERAGE" false
97-
9891let githubToken = Environment.environVarOrNone " GITHUB_TOKEN"
9992
10093let nugetToken = Environment.environVarOrNone " NUGET_KEY"
@@ -103,7 +96,6 @@ let nugetToken = Environment.environVarOrNone "NUGET_KEY"
10396// Helpers
10497//-----------------------------------------------------------------------------
10598
106-
10799let isRelease ( targets : Target list ) =
108100 targets
109101 |> Seq.map ( fun t -> t.Name)
@@ -156,8 +148,6 @@ module dotnet =
156148 DotNet.exec optionConfig command args
157149 |> failOnBadExitAndPrint
158150
159- let reportgenerator optionConfig args = tool optionConfig " reportgenerator" args
160-
161151 let sourcelink optionConfig args = tool optionConfig " sourcelink" args
162152
163153 let fcswatch optionConfig args = tool optionConfig " fcswatch" args
@@ -244,7 +234,7 @@ let allPublishChecks () = failOnLocalBuild ()
244234let disableBinLog ( p : MSBuild.CliArguments ) = { p with DisableInternalBinLog = true }
245235
246236let clean _ =
247- [ " bin" ; " temp" ; distDir; coverageReportDir ]
237+ [ " bin" ; " temp" ; distDir ]
248238 |> Shell.cleanDirs
249239
250240 !! srcGlob ++ testsGlob
@@ -357,71 +347,78 @@ let fsharpAnalyzers _ =
357347 )
358348
359349let dotnetTest ctx =
360- let excludeCoverage =
361- !! testsGlob
362- |> Seq.map IO.Path.GetFileNameWithoutExtension
363- |> String.concat " |"
350+ let args = [ " --no-build" ]
364351
365- let isGenerateCoverageReport = ctx.Context.TryFindTarget( " GenerateCoverageReport" ) .IsSome
352+ // Filter performance tests like in build.fsx
353+ let filterPerformanceTests ( p : DotNet.TestOptions ) = {
354+ p with
355+ Filter = Some " \" TestCategory!=Performance\" "
356+ Configuration = configuration ( ctx.Context.AllExecutingTargets)
357+ }
366358
367- DotNet.test
368- ( fun testOpts ->
369- if enableCodeCoverage || isGenerateCoverageReport then
370- let prepareOptions =
371- { Primitive.PrepareOptions.Create() with
359+ let testWithCoverageOptions testOpts =
360+ if enableCodeCoverage || isGenerateCoverageReport then
361+ let prepareOptions =
362+ {
363+ Primitive.PrepareOptions.Create () with
372364 AssemblyExcludeFilter = [| excludeCoverage |]
373365 LocalSource = true
374- }
375- |> AltCover.PrepareOptions.Primitive
366+ }
367+ |> AltCover.PrepareOptions.Primitive
376368
377- let collectOptions =
378- if not isGenerateCoverageReport then
379- { Primitive.CollectOptions.Create() with
369+ let collectOptions =
370+ if not isGenerateCoverageReport then
371+ {
372+ Primitive.CollectOptions.Create () with
380373 Threshold = string coverageThresholdPercent
381- }
382- else
383- Primitive.CollectOptions.Create()
384- |> AltCover.CollectOptions.Primitive
385-
386- testOpts.WithAltCoverOptions prepareOptions collectOptions ( DotNet.CLIOptions.Force( false ))
387- else
388- testOpts
389- |> fun opts -> {
390- opts with
391- MSBuildParams = disableBinLog opts.MSBuildParams
392- Configuration = configuration ( ctx.Context.AllExecutingTargets)
393- Common = opts.Common |> DotNet.Options.withAdditionalArgs [ " --no-build" ]
394- })
395- sln
396-
397- let generateCoverageReport _ =
398- let coverageReports = !! " tests/**/coverage*.xml" |> String.concat " ;"
399-
400- let sourceDirs = !! srcGlob |> Seq.map Path.getDirectory |> String.concat " ;"
401-
402- let independentArgs = [
403- $" -reports:\" %s {coverageReports}\" "
404- $" -targetdir:\" %s {coverageReportDir}\" "
405- // Add source dir
406- $" -sourcedirs:\" %s {sourceDirs}\" "
407- // Ignore Tests and if AltCover.Recorder.g sneaks in
408- sprintf " -assemblyfilters:\" %s \" " " -*.Tests;-AltCover.Recorder.g"
409- sprintf " -Reporttypes:%s " " Html"
410- ]
411-
412- let args = independentArgs |> String.concat " "
374+ }
375+ else
376+ Primitive.CollectOptions.Create ()
377+ |> AltCover.CollectOptions.Primitive
413378
414- dotnet.reportgenerator id args
379+ testOpts.WithAltCoverOptions prepareOptions collectOptions ( DotNet.CLIOptions.Force ( false ))
380+ else
381+ testOpts
415382
416- let showCoverageReport _ =
417- failOnCIBuild ()
383+ // Run the same test projects as in build.fsx
384+ DotNet.test
385+ ( filterPerformanceTests
386+ >> testWithCoverageOptions
387+ >> fun opts -> {
388+ opts with
389+ MSBuildParams = disableBinLog opts.MSBuildParams
390+ Common =
391+ opts.Common
392+ |> DotNet.Options.withAdditionalArgs [ " --no-build" ]
393+ })
394+ " tests/FSharpLint.Core.Tests"
418395
419- coverageReportDir </> " index.html"
420- |> Command.ShellCommand
421- |> CreateProcess.fromCommand
422- |> Proc.start
423- |> ignore
396+ DotNet.test
397+ ( filterPerformanceTests
398+ >> testWithCoverageOptions
399+ >> fun opts -> {
400+ opts with
401+ MSBuildParams = disableBinLog opts.MSBuildParams
402+ Common =
403+ opts.Common
404+ |> DotNet.Options.withAdditionalArgs [ " --no-build" ]
405+ })
406+ " tests/FSharpLint.Console.Tests"
407+
408+ // Restore the functional test project like in build.fsx
409+ DotNet.restore id " tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.sln"
424410
411+ DotNet.test
412+ ( filterPerformanceTests
413+ >> testWithCoverageOptions
414+ >> fun opts -> {
415+ opts with
416+ MSBuildParams = disableBinLog opts.MSBuildParams
417+ Common =
418+ opts.Common
419+ |> DotNet.Options.withAdditionalArgs [ " --no-build" ]
420+ })
421+ " tests/FSharpLint.FunctionalTest"
425422
426423let watchTests _ =
427424 !! testsGlob
@@ -646,8 +643,6 @@ let initTargets (ctx : Context.FakeExecutionContext) =
646643 Target.create " DotnetBuild" dotnetBuild
647644 Target.create " FSharpAnalyzers" fsharpAnalyzers
648645 Target.create " DotnetTest" dotnetTest
649- Target.create " GenerateCoverageReport" generateCoverageReport
650- Target.create " ShowCoverageReport" showCoverageReport
651646 Target.create " WatchTests" watchTests
652647 Target.create " GenerateAssemblyInfo" generateAssemblyInfo
653648 Target.create " DotnetPack" dotnetPack
@@ -695,9 +690,6 @@ let initTargets (ctx : Context.FakeExecutionContext) =
695690
696691 " DotnetBuild" ==>! " WatchDocs"
697692
698- " DotnetTest" ==> " GenerateCoverageReport"
699- ==>! " ShowCoverageReport"
700-
701693 " UpdateChangelog"
702694 ==> " GenerateAssemblyInfo"
703695 ==> " GitRelease"
0 commit comments