Skip to content
Discussion options

You must be logged in to vote

What’s happening here is that your tests are being run under a plain JS environment (via Node through Scala.js), but the Tauri SQL plugin expects to be running inside a Tauri runtime where window.TAURI_INTERNALS is defined.

ReferenceError: window is not defined because Node doesn’t have a window object.

you can try these

  1. Mock window for tests
    if you only need to exercise your own Scala.js code (not the actual Tauri runtime), you can provide a fake window during testing:

import scala.scalajs.js
import scala.scalajs.js.annotation._

@js.native
@JSGlobalScope
object Globals extends js.Object {
var window: js.Dynamic = js.native
}

// In your test bootstrap
Globals.window = js.Dynamic.literal(
…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nineclue
Comment options

Answer selected by nineclue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants