Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6e7e549
Support building `syscall` and `syscall/js` as `js/wasm`.
nevkontakte Oct 2, 2021
60f28c2
Fix `os` package test failures when built as `js/wasm`.
nevkontakte Oct 2, 2021
d6aec8e
Make sure GopherJS tests work correctly under when build as `js/wasm`.
nevkontakte Oct 3, 2021
7f838ba
Support `net` package when building for the target `js/wasm`.
nevkontakte Oct 17, 2021
1142005
Support `net/http` package when building for `js/wasm` target.
nevkontakte Oct 23, 2021
0ad407b
Only exclude std packages from CI if they are actually failing any te…
nevkontakte Nov 11, 2021
4170cbb
Drop GopherJS Fetch API-based http client implementation.
nevkontakte Feb 26, 2022
cdf693a
Convert prelude browser fs API stub into ES5 and reduce its size.
nevkontakte Mar 7, 2022
41de9e3
Use GOOS=js and GOARCH=ecmascript to build user code by default.
nevkontakte Mar 13, 2022
49f2893
Disable CGo when loading packages.
nevkontakte Mar 19, 2022
b94c4eb
Respect --tags flag in `gopherjs run` subcommand.
nevkontakte Mar 19, 2022
7d56422
Hide legacy `node-syscall` support behind a build tag.
nevkontakte Mar 20, 2022
305cb64
Remove unnecessary package tweaks for `crypto/rand`.
nevkontakte Mar 20, 2022
de83fe4
Remove unnecessary overlays and package tweaks for `internal/poll`.
nevkontakte Mar 20, 2022
f7681d2
Remove unnecessary standard library overlays.
nevkontakte Mar 20, 2022
59958da
Refactor TestNativesDontImportExtraPackages.
nevkontakte Mar 20, 2022
9813bf2
Remove GOROOT and GOPATH fields from `build.Options`.
nevkontakte Mar 20, 2022
9511320
Set `runtime.GOOS` and `GOARCH` to values chosen for GopherJS.
nevkontakte Mar 20, 2022
50f5dca
Fix compiler panics when building on Windows.
nevkontakte Mar 20, 2022
208100a
Catch and ignore the error if `fs` module can't be required.
nevkontakte Mar 27, 2022
3dfe12d
Set up a simple smoke test job on Windows and Mac OS.
nevkontakte Mar 27, 2022
adcfc77
Apply suggestions from code review
nevkontakte Apr 19, 2022
fe1dd62
Update VFS and minified prelude.
nevkontakte Apr 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make sure GopherJS tests work correctly under when build as js/wasm.
  - Fix skip condition in tests that should be run under normal Go.
  - TestNativesDontImportExtraPackages loads original packages with
    `js/wasm` build target.
  • Loading branch information
nevkontakte committed Apr 19, 2022
commit d6aec8e68e1bda586d93a2cb5a113aeecdde3b62
9 changes: 6 additions & 3 deletions build/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ func TestNativesDontImportExtraPackages(t *testing.T) {
// It's needed for populateImportSet.
stdOnly := gobuild.Default
stdOnly.GOPATH = "" // We only care about standard library, so skip all GOPATH packages.
// FIXME(nevkontakte): Use appropriate GOOS/GOARCH.
stdOnly.GOOS = "js"
stdOnly.GOARCH = "wasm"
forward, _, err := importgraphutil.BuildNoTests(&stdOnly)
if err != nil {
t.Fatalf("importgraphutil.BuildNoTests: %v", err)
Expand Down Expand Up @@ -76,7 +79,7 @@ func TestNativesDontImportExtraPackages(t *testing.T) {
// Normal package.
{
// Import the real normal package, and populate its real import set.
bpkg, err := gobuild.Import(pkg, "", gobuild.ImportComment)
bpkg, err := stdOnly.Import(pkg, "", gobuild.ImportComment)
if err != nil {
t.Fatalf("gobuild.Import: %v", err)
}
Expand Down Expand Up @@ -115,7 +118,7 @@ func TestNativesDontImportExtraPackages(t *testing.T) {
// Test package.
{
// Import the real test package, and populate its real import set.
bpkg, err := gobuild.Import(pkg, "", gobuild.ImportComment)
bpkg, err := stdOnly.Import(pkg, "", gobuild.ImportComment)
if err != nil {
t.Fatalf("gobuild.Import: %v", err)
}
Expand Down Expand Up @@ -154,7 +157,7 @@ func TestNativesDontImportExtraPackages(t *testing.T) {
// External test package.
{
// Import the real external test package, and populate its real import set.
bpkg, err := gobuild.Import(pkg, "", gobuild.ImportComment)
bpkg, err := stdOnly.Import(pkg, "", gobuild.ImportComment)
if err != nil {
t.Fatalf("gobuild.Import: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/natives/src/internal/syscall/unix/unix.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build js
// +build js
//go:build js && !wasm
// +build js,!wasm

package unix

Expand Down
3 changes: 1 addition & 2 deletions compiler/natives/src/syscall/js/js.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package js

import (
"reflect"
"unsafe"

"github.com/gopherjs/gopherjs/js"
Expand Down Expand Up @@ -160,7 +159,7 @@ func ValueOf(x interface{}) Value {
case bool, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, unsafe.Pointer, string, map[string]interface{}, []interface{}:
return objectToValue(id.Invoke(x))
default:
panic(`invalid arg: ` + reflect.TypeOf(x).String())
panic("ValueOf: invalid value")
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/lowlevel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
//
// See https://github.com/gopherjs/gopherjs/issues/279.
func TestTimeInternalizationExternalization(t *testing.T) {
if runtime.GOARCH == "js" {
if runtime.GOOS == "js" {
t.Skip("test meant to be run using normal Go compiler (needs os/exec)")
}

Expand All @@ -34,7 +34,7 @@ func TestTimeInternalizationExternalization(t *testing.T) {
}

func TestDeferBuiltin(t *testing.T) {
if runtime.GOARCH == "js" {
if runtime.GOOS == "js" {
t.Skip("test meant to be run using normal Go compiler (needs os/exec)")
}

Expand Down
2 changes: 1 addition & 1 deletion tests/vendored_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// Test that GopherJS can be vendored into a project, and then used to build Go programs.
// See issue https://github.com/gopherjs/gopherjs/issues/415.
func TestGopherJSCanBeVendored(t *testing.T) {
if runtime.GOARCH == "js" {
if runtime.GOOS == "js" {
t.Skip("test meant to be run using normal Go compiler (needs os/exec)")
}

Expand Down