Skip to content

panic does not trigger a failed test when within a JavaScript Promise #62

@acandoo

Description

@acandoo

I was experimenting with tests involving large amounts of JS Promises, and noticed that gleeunit ran into some issues with code involving Promises.

Here is a minimal example that passes in gleeunit but fails when run directly:

import gleam/javascript/promise
import gleeunit

pub fn main() -> Nil {
  gleeunit.main()
}

pub fn main_test() -> Nil {
  echo "testing"
  let promise1 =
    promise.new(fn(resolve) {
      echo "testing promise"
      panic
      resolve("Hello, World!")
    })

  Nil
}

The expected behavior is to match Node/Deno/Bun, which all throw errors in execution.

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