diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index c9d669652c..477162e023 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -18,7 +18,8 @@
"christian-kohler.npm-intellisense",
"ionutvmi.path-autocomplete",
"ms-python.vscode-pylance",
- "rust-lang.rust-analyzer"
+ "rust-lang.rust-analyzer",
+ "tintoy.msbuild-project-tools"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
diff --git a/Build.fsproj b/Build.fsproj
index d9874ab5f4..8d4b5510d4 100644
--- a/Build.fsproj
+++ b/Build.fsproj
@@ -12,6 +12,7 @@
+
diff --git a/build2/Main.fs b/build2/Main.fs
index 37ab139fad..581bde7419 100644
--- a/build2/Main.fs
+++ b/build2/Main.fs
@@ -40,16 +40,17 @@ Available commands:
python Run the tests for Python
dart Run the tests for Dart
rust Run the tests for Rust
- integration Run th integration test suite
+ integration Run the integration test suite
+ standalone Tests the standalone version of Fable
+ (Fable running on top of Node.js)
- Options for all except integration:
+ Options for all except integration and standalone:
--watch Watch for changes and re-run the tests
--fast Skip building fable-library if folder already exists
--no-dotnet When in watch mode, do not run the .NET tests
Options for JavaScript:
--reat-only Run only the tests for React (can be run in watch mode)
- --standalone-only Run only the tests for standalone (can't be run in watch mode)
Options for Rust:
--ast-only Run only the tests for the AST (can be run in watch mode)
@@ -80,6 +81,7 @@ let main argv =
| "dart" :: args -> Tests.Dart.handle args
| "rust" :: args -> Tests.Rust.handle args
| "integration" :: args -> Tests.Integration.handle args
+ | "standalone" :: _ -> Tests.Standalone.handle args
| _ -> printHelp ()
| "quicktest" :: args ->
match args with
@@ -88,7 +90,6 @@ let main argv =
| "python" :: _ -> Quicktest.Python.handle args
| "dart" :: _ -> Quicktest.Dart.handle args
| "rust" :: _ -> Quicktest.Rust.handle args
- // Add standalone tests here
| _ -> printHelp ()
| "sync-fcs-repo":: _ -> FcsRepo.sync ()
| "copy-fcs-repo":: _ -> FcsRepo.copy ()
diff --git a/build2/Tests/JavaScript.fs b/build2/Tests/JavaScript.fs
index 74d1abe3b8..5defb5bda3 100644
--- a/build2/Tests/JavaScript.fs
+++ b/build2/Tests/JavaScript.fs
@@ -45,39 +45,6 @@ let private testReact (isWatch: bool) =
Command.Run("npx", "jest", workingDirectory = workingDirectoy)
-let private handleStandaloneFast () =
- let fableCompilerJsDir = Path.Resolve("src", "fable-compiler-js", "src")
- let fableCompilerJsEntry = Path.Combine(fableCompilerJsDir, "app.fs.js")
- let standaloneBuildDest = Path.Resolve("build", "tests", "Standalone")
-
- Command.Fable(
- CmdLine.appendRaw "--noCache",
- workingDirectory = Path.Resolve("src", "fable-standalone", "src")
- )
-
- Command.Fable(
- CmdLine.appendPrefix "--exclude" "Fable.Core"
- >> CmdLine.appendPrefix "--define" "LOCAL_TEST"
- >> CmdLine.appendRaw "--noCache",
- workingDirectory = fableCompilerJsDir
- )
-
- // Make sure the projects are restored
- // Otherwise, on a first VM dependencies can be missing
- Command.Run("dotnet", $"restore {mainTestProject}")
-
- Command.Run(
- "node",
- CmdLine.empty
- |> CmdLine.appendRaw fableCompilerJsEntry
- |> CmdLine.appendRaw mainTestProject
- |> CmdLine.appendRaw standaloneBuildDest
- |> CmdLine.toString,
- workingDirectory = fableCompilerJsDir
- )
-
- Command.Run("npx", mochaCommand, workingDirectory = standaloneBuildDest)
-
let private handleMainTests (isWatch: bool) (noDotnet: bool) =
let folderName = "Main"
let sourceDir = Path.Resolve("tests", "Js", folderName)
@@ -141,7 +108,7 @@ let private handleMainTests (isWatch: bool) (noDotnet: bool) =
let isCI = Environment.GetEnvironmentVariable("CI") |> Option.ofObj
if isCI.IsSome then
- handleStandaloneFast ()
+ Standalone.handleStandaloneFast ()
let handle (args: string list) =
let isReactOnly = args |> List.contains "--react-only"
@@ -156,6 +123,9 @@ let handle (args: string list) =
BuildFableLibraryJavaScript().Run(skipFableLibrary)
- if isReactOnly then testReact isWatch
- else if isStandaloneOnly then handleStandaloneFast ()
- else handleMainTests isWatch noDotnet
+ if isReactOnly then
+ testReact isWatch
+ else if isStandaloneOnly then
+ Standalone.handleStandaloneFast ()
+ else
+ handleMainTests isWatch noDotnet
diff --git a/build2/Tests/Standalone.fs b/build2/Tests/Standalone.fs
new file mode 100644
index 0000000000..e7478d28b5
--- /dev/null
+++ b/build2/Tests/Standalone.fs
@@ -0,0 +1,50 @@
+module Build.Tests.Standalone
+
+open Build.FableLibrary
+open System.IO
+open System
+open BlackFox.CommandLine
+open Build.Utils
+open Build
+open SimpleExec
+
+let private mainTestProject =
+ Path.Resolve("tests", "Js", "Main", "Fable.Tests.fsproj")
+
+let private mochaCommand = "npx mocha . --reporter dot -t 10000"
+
+let handleStandaloneFast () =
+ let fableCompilerJsDir = Path.Resolve("src", "fable-compiler-js", "src")
+ let fableCompilerJsEntry = Path.Combine(fableCompilerJsDir, "app.fs.js")
+ let standaloneBuildDest = Path.Resolve("build", "tests", "Standalone")
+
+ Command.Fable(
+ CmdLine.appendRaw "--noCache",
+ workingDirectory = Path.Resolve("src", "fable-standalone", "src")
+ )
+
+ Command.Fable(
+ CmdLine.appendPrefix "--exclude" "Fable.Core"
+ >> CmdLine.appendPrefix "--define" "LOCAL_TEST"
+ >> CmdLine.appendRaw "--noCache",
+ workingDirectory = fableCompilerJsDir
+ )
+
+ // Make sure the projects are restored
+ // Otherwise, on a first VM dependencies can be missing
+ Command.Run("dotnet", $"restore {mainTestProject}")
+
+ Command.Run(
+ "node",
+ CmdLine.empty
+ |> CmdLine.appendRaw fableCompilerJsEntry
+ |> CmdLine.appendRaw mainTestProject
+ |> CmdLine.appendRaw standaloneBuildDest
+ |> CmdLine.toString,
+ workingDirectory = fableCompilerJsDir
+ )
+
+ Command.Run("npx", mochaCommand, workingDirectory = standaloneBuildDest)
+
+let handle (args: string list) =
+ handleStandaloneFast ()