forked from microsoft/TypeScript-DOM-lib-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
31 lines (25 loc) · 843 Bytes
/
build.fsx
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
#r "packages/FAKE/tools/FakeLib.dll"
#load "TS.fsx"
open Fake
open TS.Emit
open System
open System.IO
Target "Run" (fun _ ->
TS.Emit.EmitDomWeb()
TS.Emit.EmitDomWorker()
)
let testFile file =
let baseline = File.ReadAllText("./baselines/" + file).Replace("\r\n", "\n").Trim('\n')
let newFileWithLFEndings = File.ReadAllText("./generated/" + file).Replace("\r\n", "\n").Trim('\n')
if String.Equals(baseline, newFileWithLFEndings) then
String.Empty
else
sprintf "\nTest failed: %s is different from baseline file." file
Target "Test" (fun _ ->
Directory.GetFiles("./baselines")
|> Array.map (Path.GetFileName >> testFile)
|> String.concat ""
|> (fun msg -> if String.IsNullOrEmpty(msg) then tracefn "All tests passed." else failwith msg)
)
"Run" ==> "Test"
RunTargetOrDefault "Test"