Use httptest to serve wasm test files.

This picks a port automatically, so avoids any conflicts that might
arise from running the tests in parallel.
This commit is contained in:
Elliott Sales de Andrade
2020-12-22 17:56:53 -05:00
committed by Ron Evans
parent 5bae55d755
commit f3bdebe2a6
6 changed files with 40 additions and 34 deletions
+4 -1
View File
@@ -20,6 +20,9 @@ func TestFmt(t *testing.T) {
t.Parallel()
wasmTmpDir, server, cleanup := startServer(t)
defer cleanup()
err := run("tinygo build -o " + wasmTmpDir + "/fmt.wasm -target wasm testdata/fmt.go")
if err != nil {
t.Fatal(err)
@@ -30,7 +33,7 @@ func TestFmt(t *testing.T) {
var log1 string
err = chromedp.Run(ctx,
chromedp.Navigate("http://localhost:8826/run?file=fmt.wasm"),
chromedp.Navigate(server.URL+"/run?file=fmt.wasm"),
chromedp.Sleep(time.Second),
chromedp.InnerHTML("#log", &log1),
waitLog(`did not panic`),