GopherJS browser tests
Run compiled Go tests in the browser using GopherJS
Import the browsertests package in one of your tests to ensure the browser interface is initialised:
import _ "bitbucket.org/mikehouston/browsertests"
To compile your tests, use GopherJS:
$ gopherjs test -c
<html> <body> <p>To recompile tests use <code>gopherjs test -c</code></p> <script src="browsertests_test.js"></script> </body> </html>
Then run the tests by opening the HTML file in a browser. The easiest way to do this is
to run the
gopherjs serve command and navigate to the package you want to test.
$ go get -u bitbucket.org/mikehouston/browsertests