Skip to content

Commit

Permalink
Merge pull request #2543 from robertpi/add-support-for-env-var-to-nunit
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid authored Sep 9, 2020
2 parents c6d83f4 + 2e19bfb commit 514bb27
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/Fake.DotNet.Testing.NUnit/NUnit3.fs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,13 @@ type NUnit3Params =

/// A test parameter specified in the form name=value. Multiple parameters may be specified, separated by semicolons
Params : string

/// list or environment variables that will be set in the nunit-console.exe process
Environment : Map<string, string>
}
/// Sets the current environment variables.
member x.WithEnvironment map =
{ x with Environment = map }

/// The [NUnit3Params](fake-testing-nunit3-nunit3params.html) default parameters.
///
Expand Down Expand Up @@ -245,6 +251,7 @@ type NUnit3Params =
/// - `TraceLevel` - `Default` (By default NUnit3 sets this to off internally)
/// - `SkipNonTestAssemblies` - `false`
/// - `Params` - `""`
/// - `EnvironmentVariables` - `[]`
/// ## Defaults
let NUnit3Defaults =
{
Expand Down Expand Up @@ -273,6 +280,7 @@ let NUnit3Defaults =
TraceLevel= NUnit3TraceLevel.Default
SkipNonTestAssemblies = false
Params = ""
Environment = Map.empty
}

/// Tries to detect the working directory as specified in the parameters or via TeamCity settings
Expand Down Expand Up @@ -331,6 +339,7 @@ let internal createProcess createTempFile (setParams : NUnit3Params -> NUnit3Par
CreateProcess.fromRawCommandLine tool argLine
|> CreateProcess.withFramework
|> CreateProcess.withWorkingDirectory (getWorkingDir parameters)
|> CreateProcess.withEnvironment (parameters.Environment |> Map.toList)
//|> CreateProcess.withTimeout processTimeout
|> CreateProcess.addOnSetup (fun () ->
File.WriteAllText(path, generatedArgs)
Expand Down

0 comments on commit 514bb27

Please sign in to comment.