Skip to content

Latest commit

 

History

History

gjbt

gjbt

gjbt is a simple (temporary) wrapper for GopherJS to run tests in Chrome as opposed to NodeJS.

go get -u myitcv.io/cmd/gjbt

gjbt is a simple (temporary) wrapper for GopherJS to run tests in Chrome as opposed to NodeJS. It should be considered to be a direct replacement for gopherjs test.

Running your tests in Chrome has a number of benefits:

  • it is almost certainly the VM in which your code will ultimately run
  • you have full access to the DOM

Usage

$ gjbt myitcv.io/gjbt
ok      myitcv.io/gjbt  0.273s
PASS

Requirements

Test Requirements

(For now) A small wrapper is required around TestMain in each package to be tested. It is sufficient to copy init_test.go, modifying the test package name, to your package.

DOM Access

See the tests in myitcv.io/react for examples of DOM access.

TODO

  • Switch from being GopherJS specific to also allowing WASM-based tests. At which point gjbt starts to stand for Go Javascript Browswer Test... Indeed at some point we'll need to consider whether the 'j' has any meaning at all!