Skip to content
This repository was archived by the owner on Aug 27, 2018. It is now read-only.
This repository was archived by the owner on Aug 27, 2018. It is now read-only.

How to write tests? #144

@breml

Description

@breml

I tried to write tests in combination with this package. I tired with this minimal file (react_test.go):

package testreact

import (
	"testing"

	_ "myitcv.io/react"
)

func TestReact(t *testing.T) {
	t.Log("OK")
}

If I execute go test ., the following output is given:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4e6082]

goroutine 1 [running]:
github.com/gopherjs/gopherjs/js.(*Object).Get(0x0, 0x5311e3, 0x5, 0xc4200543e0)
	/home/lubr/code/go/src/github.com/gopherjs/gopherjs/js/js.go:32 +0x22
FAIL	github.com/breml/reacttest/test	0.003s

If I use gopherjs tes ., then the output is:

gopherjs: Source maps disabled. Install source-map-support module for nice stack traces. See https://github.com/gopherjs/gopherjs#gopherjs-run-gopherjs-test.
/home/lubr/code/go/src/github.com/breml/reacttest/test/test.629576433:24995
var o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,l,u=r(e),c=1;c<arguments.length;c++){n=Object(arguments[c]);for(var s in n)a.call(n,s)&&(u[s]=n[s]);if(o){l=o(n);for(var f=0;f<l.length;f++)i.call(n,l[f])&&(u[l[f]]=n[l[f]])}}return u}},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r

ReferenceError: window is not defined
    at Object.t (/home/lubr/code/go/src/github.com/breml/reacttest/test/test.629576433:24995:1138)
    at t (/home/lubr/code/go/src/github.com/breml/reacttest/test/test.629576433:24990:146)
    at /home/lubr/code/go/src/github.com/breml/reacttest/test/test.629576433:24990:503
    at /home/lubr/code/go/src/github.com/breml/reacttest/test/test.629576433:24990:512
    at Object.<anonymous> (/home/lubr/code/go/src/github.com/breml/reacttest/test/test.629576433:25012:5)
    at Object.<anonymous> (/home/lubr/code/go/src/github.com/breml/reacttest/test/test.629576433:35738:4)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3
FAIL	github.com/breml/reacttest/test	0.299s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions