Skip to content

tracking: complete std/expect #3964

@iuioiua

Description

@iuioiua
Contributor

The following APIs are currently not yet implemented in std/expect:

For those wanting to contribute, please submit one PR per API.

Activity

changed the title [-]tracking: complete `std/expct`[/-] [+]tracking: complete `std/expect`[/+] on Dec 15, 2023
raashidanwar

raashidanwar commented on Dec 18, 2023

@raashidanwar

Hey @iuioiua,
I would love to contribute here.

iuioiua

iuioiua commented on Dec 18, 2023

@iuioiua
ContributorAuthor

Hey @iuioiua,

I would love to contribute here.

Great! Let us know which ones you'd like to work on, so there's no overlap with other's work.

syhol

syhol commented on Dec 18, 2023

@syhol
Contributor

As you start working on the async matchers, you might end up fixing #3947 as a side effect.

raashidanwar

raashidanwar commented on Jan 1, 2024

@raashidanwar

@iuioiua I will be picking.

expect.objectContaining
expect.not.objectContaining
expect.stringContaining
expect.not.stringContaining
expect.stringMatching
expect.not.stringMatching
added
PR welcomeA pull request for this issue would be welcome
and removed
help wantedExtra attention is needed
on Jan 22, 2024
eryue0220

eryue0220 commented on Jan 24, 2024

@eryue0220
Contributor

Hi @iuioiua @raashidanwar
Can I try for this too?

I'll pick

expect.assertions
expect.hasAssertions
expect.addSnapshotSerializer
expect.extend
iuioiua

iuioiua commented on Jan 24, 2024

@iuioiua
ContributorAuthor

Hi @iuioiua @raashidanwar Can I try for this too?

I'll pick

expect.assertions
expect.hasAssertions
expect.addSnapshotSerializer
expect.extend

For sure! Thank you. Please let us know if you need any help with anything.

eryue0220

eryue0220 commented on Jan 25, 2024

@eryue0220
Contributor

Hi, @iuioiua

I have a question about is there a way that I can know whether the current Deno.test is completed or not?

iuioiua

iuioiua commented on Jan 28, 2024

@iuioiua
ContributorAuthor

Can you elaborate? Perhaps, something like this is what you're after.

let isTestDone = false;
Deno.test("my test", () => {
  ...
  isTestDone = true;
});

16 remaining items

kt3k

kt3k commented on Mar 16, 2024

@kt3k
Member

Yes, it corresponds to jest.fn https://jestjs.io/docs/mock-functions

finleyjb

finleyjb commented on Sep 26, 2024

@finleyjb
Contributor

I'm considering implementing objectContaining. Is anyone working on this?

eryue0220

eryue0220 commented on Sep 26, 2024

@eryue0220
Contributor

I'm considering implementing objectContaining. Is anyone working on this?

Yes, I'm doing this now. You could try other API.

rperryng

rperryng commented on Oct 24, 2024

@rperryng

Yes, it corresponds to jest.fn jestjs.io/docs/mock-functions

on that note, are there plans to improve the type-safety around fn() to match the type-safety of jest.fn()?

  // Create a new mock that can be used in place of `add`.
  const mockAdd = jest.fn<typeof add>();

  // `.mockImplementation()` now can infer that `a` and `b` are `number`
  // and that the returned value is a `number`.
  mockAdd.mockImplementation((a, b) => {
    // Yes, this mock is still adding two numbers but imagine this
    // was a complex function we are mocking.
    return a + b;
  });

(from: docs for jest.fn())

Since fn() currently is typed as Function, it returns any (which the typescript docs mention as a reason to avoid its usage).

(I hope this is the right place for this conversation, I couldn't find any other open issues that cover this topic yet)

WWRS

WWRS commented on Mar 31, 2025

@WWRS
Contributor

I can implement toMatchSnapshot and toThrowErrorMatchingSnapshot, but I want to see if dependencies change in #6541 before starting.

Same for toMatchInlineSnapshot and toThrowErrorMatchingInlineSnapshot, but I am also waiting on #6530.

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

    PR welcomeA pull request for this issue would be welcomeenhancementNew feature or requestexpectgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @kt3k@syhol@eryue0220@rperryng@timreichen

        Issue actions

          tracking: complete `std/expect` · Issue #3964 · denoland/std