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
@@ -11,6 +11,9 @@ func TestChan(t *testing.T) {
t.Parallel()
wasmTmpDir, server, cleanup := startServer(t)
defer cleanup()
err := run("tinygo build -o " + wasmTmpDir + "/chan.wasm -target wasm testdata/chan.go")
if err != nil {
t.Fatal(err)
@@ -20,7 +23,7 @@ func TestChan(t *testing.T) {
defer cancel()
err = chromedp.Run(ctx,
chromedp.Navigate("http://localhost:8826/run?file=chan.wasm"),
chromedp.Navigate(server.URL+"/run?file=chan.wasm"),
waitLog(`1
2
4