Repository navigation
Expand file tree
/
Copy pathTestTasks.fs
More file actions
123 lines (100 loc) · 5.85 KB
/
Copy pathTestTasks.fs
File metadata and controls
123 lines (100 loc) · 5.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
module TestTasks
open BlackFox.Fake
open Fake.DotNet
open Fake.Core
open ProjectInfo
open BasicTasks
let createTestBuildTask (name: string) (deps: BuildTask.TaskInfo list) (projects: ProjectInfo list) =
BuildTask.create name deps {
projects
|> List.iter (fun pInfo ->
let proj = pInfo.ProjFile
proj
|> DotNet.build (fun p ->
{
p with
MSBuildParams = { p.MSBuildParams with DisableInternalBinLog = true}
}
|> DotNet.Options.withCustomParams (Some "--no-dependencies -tl")
)
)
}
let buildTestsAll = createTestBuildTask "BuildTestsAll" [clean; build] (testBaseProjects @ testProjectsCore @ testProjectsExtensionsLibs)
let buildTestsCore = createTestBuildTask "BuildTestsCore" [clean; build] (testBaseProjects @ testProjectsCore)
let buildTestsExtensionsLibs = createTestBuildTask "BuildTestsExtensionsLibs" [clean; build] (testBaseProjects @ testProjectsExtensionsLibs)
let private testArguments (project: ProjectInfo) =
let results = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(project.ProjFile), "TestResults")
$"-tl --logger \"trx;LogFileName={project.Name}.trx\" --results-directory \"{results}\""
let createRunTestTask (name: string) (deps: BuildTask.TaskInfo list) (projects: ProjectInfo list) =
BuildTask.create name deps {
projects
|> Seq.iter (fun testProjectInfo ->
Fake.DotNet.DotNet.test
(fun testParams ->
{ testParams with
Logger = Some "console;verbosity=detailed"
Configuration = DotNet.BuildConfiguration.fromString configuration
NoBuild = true
MSBuildParams = { testParams.MSBuildParams with DisableInternalBinLog = true }
}
|> DotNet.Options.withCustomParams (Some (testArguments testProjectInfo))
)
testProjectInfo.ProjFile
)
}
let createRunTestFastTask (name: string) (projects: ProjectInfo list) =
BuildTask.create name [] {
Trace.trace $"Running {name} without Clean, while letting dotnet test handle restore and incremental builds."
projects
|> Seq.iter (fun testProjectInfo ->
Fake.DotNet.DotNet.test
(fun testParams ->
{ testParams with
Logger = Some "console;verbosity=detailed"
Configuration = DotNet.BuildConfiguration.fromString configuration
MSBuildParams = { testParams.MSBuildParams with DisableInternalBinLog = true }
}
|> DotNet.Options.withCustomParams (Some (testArguments testProjectInfo))
)
testProjectInfo.ProjFile
)
}
let createRunSingleTestProjectFastTask (project: ProjectInfo) =
createRunTestFastTask $"Run{project.Name}Fast" [ project ]
/// runs the all test projects via `dotnet test`
let runTestsAll = createRunTestTask "RunTestsAll" [ clean; build; buildTestsAll ] (testProjectsCore @ testProjectsExtensionsLibs)
/// runs the core test projects via `dotnet test`
let runTestsCore = createRunTestTask "RunTestsCore" [ clean; build; buildTestsCore; buildTestsCore] testProjectsCore
/// runs the extension lib test projects via `dotnet test`
let runTestsExtensionLibs = createRunTestTask "RunTestsExtensionLibs" [ clean; build; buildTestsExtensionsLibs] testProjectsExtensionsLibs
/// runs all test projects via incremental `dotnet test`, without cleaning first.
let runTestsAllFast = createRunTestFastTask "RunTestsAllFast" (testProjectsCore @ testProjectsExtensionsLibs)
/// runs core test projects via incremental `dotnet test`, without cleaning first.
let runTestsCoreFast = createRunTestFastTask "RunTestsCoreFast" testProjectsCore
/// runs extension lib test projects via incremental `dotnet test`, without cleaning first.
let runTestsExtensionLibsFast = createRunTestFastTask "RunTestsExtensionLibsFast" testProjectsExtensionsLibs
/// runs the ImageExportTests project via incremental `dotnet test`, without cleaning first.
let runImageExportTestsFast = createRunSingleTestProjectFastTask ImageExportTestProject
/// runs the CSharpTests project via incremental `dotnet test`, without cleaning first.
let runCSharpTestsFast = createRunSingleTestProjectFastTask CSharpTestProject
/// Focused Verso formatter/assembly-isolation tests without cleaning.
let runVersoTestsFast = createRunSingleTestProjectFastTask VersoTestProject
/// Focused deterministic Chromium rendering tests without cleaning.
let runVersoBrowserTestsFast = createRunSingleTestProjectFastTask VersoBrowserTestProject
let buildVersoTests = createTestBuildTask "BuildVersoTests" [clean; build] (testBaseProjects @ [VersoTestProject])
let buildVersoBrowserTests = createTestBuildTask "BuildVersoBrowserTests" [clean; build] [VersoBrowserTestProject]
let runVersoTests = createRunTestTask "RunVersoTests" [buildVersoTests] [VersoTestProject]
let runVersoBrowserTests = createRunTestTask "RunVersoBrowserTests" [buildVersoBrowserTests] [VersoBrowserTestProject]
/// Provision Chromium explicitly in CI; the same pinned browser is used by local tests.
let prepareVersoBrowser =
BuildTask.create "PrepareVersoBrowser" [] {
DotNet.build
(fun p ->
{ p with
Configuration = DotNet.BuildConfiguration.fromString configuration
MSBuildParams = { p.MSBuildParams with DisableInternalBinLog = true } })
VersoBrowserTestProject.ProjFile
let assembly = $"tests/ExtensionLibsTests/VersoBrowserTests/bin/{configuration}/net10.0/VersoBrowserTests.dll"
let result = DotNet.exec id assembly "--install-browser"
if result.ExitCode <> 0 then failwith "Chromium provisioning failed."
}