<commit_before>﻿#I @"../../packages/build/FAKE/tools"
#r @"FakeLib.dll"

#load @"Projects.fsx"
#load @"Paths.fsx"
#load @"Tooling.fsx"

open System.IO
open Fake 
open Paths
open Projects
open Tooling

module Tests = 
    open System.Threading
    open System

    let private buildingOnTravis = getEnvironmentVarAsBool "TRAVIS"

    let private setLocalEnvVars() = 
        let clusterFilter =  getBuildParamOrDefault "escluster" ""
        let testFilter = getBuildParamOrDefault "testfilter" ""
        setProcessEnvironVar "NEST_INTEGRATION_CLUSTER" clusterFilter
        setProcessEnvironVar "NEST_TEST_FILTER" testFilter

    type MultiTarget = All | One  
    let private dotnetTest target =
        CreateDir Paths.BuildOutput
        let command = 
            let p = ["xunit"; "-parallel"; "all"; "-xml"; "../.." @@ Paths.Output("TestResults-Desktop-Clr.xml")] 
            match (target, buildingOnTravis) with 
            | (_, true) 
            | (One, _) -> p |> List.append ["-framework"; "netcoreapp1.1"]
            | _  -> p

        let dotnet = Tooling.BuildTooling("dotnet")
        dotnet.ExecIn "src/Tests" command |> ignore

    let IncrementalTest() = 
        setLocalEnvVars()
        dotnetTest One 

    let RunUnitTests() = 
        setLocalEnvVars()
        dotnetTest All

    let RunIntegrationTests() =
        setLocalEnvVars()
        let commaSeparatedEsVersions = getBuildParamOrDefault "esversions" "" 
        let esVersions = 
            match commaSeparatedEsVersions with
            | "" -> failwith "when running integrate you have to pass a comma separated list of elasticsearch versions to test"
            | _ -> commaSeparatedEsVersions.Split ',' |> Array.toList 
        
        for esVersion in esVersions do
            setProcessEnvironVar "NEST_INTEGRATION_VERSION" esVersion
            dotnetTest One |> ignore<commit_msg>fix travis build, -frameworks needs to append to p not visa versa<commit_after>﻿#I @"../../packages/build/FAKE/tools"
#r @"FakeLib.dll"

#load @"Projects.fsx"
#load @"Paths.fsx"
#load @"Tooling.fsx"

open System.IO
open Fake 
open Paths
open Projects
open Tooling

module Tests = 
    open System.Threading
    open System

    let private buildingOnTravis = getEnvironmentVarAsBool "TRAVIS"

    let private setLocalEnvVars() = 
        let clusterFilter =  getBuildParamOrDefault "escluster" ""
        let testFilter = getBuildParamOrDefault "testfilter" ""
        setProcessEnvironVar "NEST_INTEGRATION_CLUSTER" clusterFilter
        setProcessEnvironVar "NEST_TEST_FILTER" testFilter

    type MultiTarget = All | One  
    let private dotnetTest target =
        CreateDir Paths.BuildOutput
        let command = 
            let p = ["xunit"; "-parallel"; "all"; "-xml"; "../.." @@ Paths.Output("TestResults-Desktop-Clr.xml")] 
            match (target, buildingOnTravis) with 
            | (_, true) 
            | (One, _) -> ["-framework"; "netcoreapp1.1"] |> List.append p 
            | _  -> p

        let dotnet = Tooling.BuildTooling("dotnet")
        dotnet.ExecIn "src/Tests" command |> ignore

    let IncrementalTest() = 
        setLocalEnvVars()
        dotnetTest One 

    let RunUnitTests() = 
        setLocalEnvVars()
        dotnetTest All

    let RunIntegrationTests() =
        setLocalEnvVars()
        let commaSeparatedEsVersions = getBuildParamOrDefault "esversions" "" 
        let esVersions = 
            match commaSeparatedEsVersions with
            | "" -> failwith "when running integrate you have to pass a comma separated list of elasticsearch versions to test"
            | _ -> commaSeparatedEsVersions.Split ',' |> Array.toList 
        
        for esVersion in esVersions do
            setProcessEnvironVar "NEST_INTEGRATION_VERSION" esVersion
            dotnetTest One |> ignore
{'fraction_non_alphanumeric': 0.09531290913851793, 'fraction_numerical': 0.0010473946059177796, 'mean_word_length': 2.5239852398523985, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4893764', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1101, 'n_words': 284}