I suppose you need to load and run the tests in browser... this might 
help: https://github.com/agnivade/wasmbrowsertest

On Friday, 8 April 2022 at 9:31:59 pm UTC+10 mi...@ubo.ro wrote:

> I'm trying to unitest a browser wasm/js application but it seems that the 
> browser objects are missing. I assume that the testing package is using a 
> "serverside" node API so I wonder how can I make go test use a real browser 
> to run the tests. The test below fails
>
> func TestTransform(t *testing.T) {
>   doc := js.Global().Get("document")
>   if !doc.Truthy() {
>    t.Fatalf("window.document not available?? wrong environment")
>   }
>
> } 
>
> // $ GOOS=js GOARCH=wasm go test
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/00d7092c-e99c-4c98-9392-bc20d62327b5n%40googlegroups.com.

Reply via email to