browsertests /

Filename Size Date modified Message
23 B
Added example tests
929 B
README.md edited online with Bitbucket
140 B
Added build flags and empty go file to allow tests to run in standard environment
250 B
Added example tests
158 B
Append logs to body innerHTML rather than using document.write
1.1 KB
Append logs to body innerHTML rather than using document.write
1.6 KB
Added build flags and empty go file to allow tests to run in standard environment

GopherJS browser tests

Run compiled Go tests in the browser using GopherJS

Usage

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

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

<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.

Screenshot_29_08_2016__16_00.jpg

Installation

$ go get -u bitbucket.org/mikehouston/browsertests