FSharp.Formatting icon indicating copy to clipboard operation
FSharp.Formatting copied to clipboard

Using testcontainers in a fsx script gives wrong output

Open rbauduin opened this issue 5 months ago • 7 comments

Putting this fsx in the docs directory:

> (**
# Usage
*)
(*** hide ***)

#r "nuget: Testcontainers.PostgreSql, 3.6.0"
open Testcontainers.PostgreSql
task {
(** # Start container *)
  let container =
    (new PostgreSqlBuilder())
          .WithImage("postgres:16")
          .Build();
  do! container.StartAsync()
  printfn "%s" (container.GetConnectionString())
(** But let's not forget to stop it with *)
  do! container.DisposeAsync().AsTask()
(*** hide ***)
}
|> Async.AwaitTask |> Async.RunSynchronously

and then running fsdocs build gives a page with content about test containers: image

It can be reproduced on linux with these commands:

:/tmp$ dotnet new console --language "F#" -n fsdocdemo
:/tmp$ cd fsdocdemo/
:/tmp/fsdocdemo$ mkdir docs
:/tmp/fsdocdemo$ cat >docs/minimal.fsx <<EOF
> (**
# Usage
*)
(*** hide ***)

#r "nuget: Testcontainers.PostgreSql, 3.6.0"
open Testcontainers.PostgreSql
task {
(** # Start container *)
  let container =
    (new PostgreSqlBuilder())
          .WithImage("postgres:16")
          .Build();
  do! container.StartAsync()
  printfn "%s" (container.GetConnectionString())
(** But let's not forget to stop it with *)
  do! container.DisposeAsync().AsTask()
(*** hide ***)
}
|> Async.AwaitTask |> Async.RunSynchronously
EOF
:/tmp/fsdocdemo$ fsdocs build
:/tmp/fsdocdemo$ cd output
:/tmp/fsdocdemo$ python -m http.server

and access http://localhost:8000/minimal.html

Some more information:

$ dotnet --version
6.0.418
$ fsdocs --version
fsdocs 19.1.1
$ uname -r
6.2.0-37-generic

rbauduin avatar Jan 15 '24 14:01 rbauduin