browsertests /

Filename Size Date modified Message
23 B
929 B
140 B
250 B
158 B
1.1 KB
1.6 KB

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 _ ""

To compile your tests, use GopherJS:

$ gopherjs test -c

To run the tests you will need an HTML file to load the JavaScript:

        <p>To recompile tests use <code>gopherjs test -c</code></p>
        <script src="browsertests_test.js"></script>

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