Skip to content

Add custom message to expect function of bun:test module #10414

Closed

Description

@abhi3700

What is the problem this feature would solve?

How can i translate this chai package based assertion:

assert(amount.lte(currentBalance), "Insufficient WTSSC in sender's balance")

to that of bun.

I have been able to write this using bun:test, but couldn't find any place to add the error message 😞 .

expect(amount.lte(currentBalance)).toBe(true)

What is the feature you are proposing to solve the problem?

Add custom message to expect. The structure of this could look like this:

expect(amount.lte(currentBalance)).toBe(true).message("Insufficient WTSSC in sender's balance")

What alternatives have you considered?

I am using chai package for this work. Here is a code snippet:

import { assert } from 'chai'

assert(amount.lte(currentBalance), "Insufficient WTSSC in sender's balance")

Activity

  1. abhi3700 commented on Aug 14, 2024

    @abhi3700
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bun:testSomething related to the `bun test` runnerenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions