Comments (11)
I haven't had a chance yet but will try to get to it soon. Try just making a test that fires a callback in 10ms and then end the test successfully after 9ms. Should work if the callback fires just after the test ends.
from wasmbrowsertest.
Thanks, do you have a reproducer by any chance that I can use?
from wasmbrowsertest.
I will try to put one together. In this case I believe the code had run some IndexedDB queries with https://github.com/aperturerobotics/go-indexeddb and then the onsuccess callback was being called after the program had exited.
A possible test case would be to spam callbacks to the Go runtime and then succeed the test. The callback should be able to fire and call into Go wasm (which causes an error in the browser as well) just after the test exits, reproducing the issue.
from wasmbrowsertest.
@paralin - Just checking if you were able to find some time on this?
from wasmbrowsertest.
CI failure examples of this issue:
- https://github.com/aperturerobotics/util/actions/runs/9881287652/job/27291736799#step:14:282
- https://github.com/aperturerobotics/bifrost/actions/runs/9881375168/job/27292026324#step:14:1214
from wasmbrowsertest.
I've seen the same issue.
http://127.0.0.1:35499/wasm_exec.js:535:10 Uncaught
Error: Go program has already exited
at globalThis.Go._resume (http://127.0.0.1:35499/wasm_exec.js:536:11)
at http://127.0.0.1:35499/wasm_exec.js:264:14
context canceled
https://github.com/hajimehoshi/ebiten/actions/runs/9927011041/job/27421409861
from wasmbrowsertest.
Thanks Hajime san. This is on my mind. Work has been a bit busy these days.
from wasmbrowsertest.
We can mitigate the issue by adding a sleep like this:
func TestMain(m *testing.M) {
code := m.Run()
time.Sleep(100 * time.Millisecond)
os.Exit(code)
}
from wasmbrowsertest.
@hajimehoshi @paralin - I am trying with this:
func TestCallback(t *testing.T) {
js.Global().Call("setTimeout", js.FuncOf(func(js.Value, []js.Value) interface{} {
t.Log("hey there")
return nil
}), 1000)
t.Log("done")
}
but unable to reproduce the issue. What am I doing wrong?
from wasmbrowsertest.
Aha nvm, I am able to repro now. The thing is that the timeout needs to fire between the small window when the test has exited, but the browser hasn't yet unloaded.
Repro case:
func TestCallback(t *testing.T) {
js.Global().Call("setInterval", js.FuncOf(func(js.Value, []js.Value) interface{} {
t.Log("hey there")
return nil
}), 5)
t.Log("done")
}
from wasmbrowsertest.
Thanks!
from wasmbrowsertest.
Related Issues (20)
- "panic: newosproc: not implemented" when executing in travis HOT 1
- `could not dial` errors on the latest Chrome on GitHub Actions HOT 4
- Support -shuffle flag HOT 1
- Accept permission HOT 2
- please enable discussions on this repo HOT 4
- Is there an example dockerfile? HOT 1
- goroutine support HOT 14
- Error: command line too long HOT 6
- cross browser testing HOT 5
- using -- to signify end of options HOT 8
- `total length of command line and environment variables exceeds limit` in GitHub Actions HOT 27
- error generating coverage report HOT 7
- A way to test WASM aims to be run in the web worker HOT 10
- update documentation regarding go 1.20 coverage tools HOT 3
- Is there away to click "OK" on an alert window? HOT 2
- getting a webgl context fails on macOS HOT 8
- Flaky test TestRun/panic_fails in Windows HOT 9
- Failed to run while using Go Toolchain HOT 11
- fail with "panic: unexpected call to os.Exit(0) during test" HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasmbrowsertest.