Skip to content

Commit

Permalink
Merge pull request #640 from SAFE-Stack/restore-solutions-before-test
Browse files Browse the repository at this point in the history
Fix error caused by restore on running tests + build solution before run, instead of just restore
  • Loading branch information
Larocceau authored Nov 29, 2024
2 parents d91c3bb + ad14679 commit 259b130
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions Content/default/Build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,27 @@ Target.create "Azure" (fun _ ->

deployment |> Deploy.execute "SAFE-App" Deploy.NoParameters |> ignore)

Target.create "Run" (fun _ ->
run dotnet [ "restore"; "Application.sln" ] "."
run dotnet [ "build" ] sharedPath
Target.create "Build" (fun _ ->
run dotnet [ "build"; "Application.sln" ] "."

)

Target.create "Run" (fun _ ->
[
"server", dotnet [ "watch"; "run"; "--no-restore" ] serverPath
"client", dotnet [ "fable"; "watch"; "-o"; "output"; "-s"; "--run"; "npx"; "vite" ] clientPath
]
|> runParallel)

let buildSharedTests () = run dotnet [ "build" ] sharedTestsPath

Target.create "RunTestsHeadless" (fun _ ->
buildSharedTests ()

run dotnet [ "run" ] serverTestsPath
run dotnet [ "fable"; "-o"; "output" ] clientTestsPath
run npx [ "mocha"; "output" ] clientTestsPath
)

Target.create "WatchRunTests" (fun _ ->
buildSharedTests ()

[
"server", dotnet [ "watch"; "run" ] serverTestsPath
"server", dotnet [ "watch"; "run"; "--no-restore" ] serverTestsPath
"client", dotnet [ "fable"; "watch"; "-o"; "output"; "-s"; "--run"; "npx"; "vite" ] clientTestsPath
]
|> runParallel)
Expand All @@ -79,11 +75,10 @@ open Fake.Core.TargetOperators

let dependencies = [
"Clean" ==> "RestoreClientDependencies" ==> "Bundle" ==> "Azure"
"Clean" ==> "RestoreClientDependencies" ==> "Build" ==> "Run"

"Clean" ==> "RestoreClientDependencies" ==> "Run"

"RestoreClientDependencies" ==> "RunTestsHeadless"
"RestoreClientDependencies" ==> "WatchRunTests"
"RestoreClientDependencies" ==> "Build" ==> "RunTestsHeadless"
"RestoreClientDependencies" ==> "Build" ==> "WatchRunTests"
]

[<EntryPoint>]
Expand Down

0 comments on commit 259b130

Please sign in to comment.