question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature]: Expose equals from expect package.

See original GitHub issue

🚀 Feature Proposal

Slightly popular package jest-when(https://www.npmjs.com/package/jest-when) that depend on “expect” use portion of private api require('expect/build/jasmineUtils') I just raised PR to use jest as peer https://github.com/timkindberg/jest-when/pull/84

We would like to ask jest to expose “equals” from jasmineUtils or provide suitable API to get current equals matcher.

Motivation

  1. I am worried that can break with ESM enforcing exports fields
  2. jest-when use private api it is withing jest project rights to break it on minor releases.
  3. Hopefully jest project consider adding jest-when functionality to core as it is useful and good API

Example

No response

Pitch

See above motivation. Either expose equals or provide jest-when compatible functionality in core.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:9

github_iconTop GitHub Comments

8reactions
SimenBcommented, Sep 13, 2021

Hmm, I guess this isn’t a custom matcher, but used within the mock function itself? That’s a bit more tricky. Essentially same as #11816

5reactions
SimenBcommented, Feb 7, 2022

Hi @ErisDS, and thanks for the detailed use case! I’ll be adding a separate @jest/expect-utils in Jest 28 🙂 It’ll suddenly be available. jest-snapshot itself also uses “private” stuff from expect

Read more comments on GitHub >

github_iconTop Results From Across the Web

expect | Yarn - Package Manager
This package exports the expect function used in Jest. You can find its documentation on Jest's website. readme. expect. This package exports the...
Read more >
Expect · Jest
The expect function is used every time you want to test a value. You will rarely call expect by itself. Instead, you will...
Read more >
Assertion Styles - Chai
Expect. The BDD style is exposed through expect or should interfaces. In both scenarios, you chain together natural language assertions. var expect =...
Read more >
7. Package Description — Cabal 3.4.0.0 User's Guide
At most one library, exposing a number of Haskell modules. ... These can be used to enable or disable certain features of a...
Read more >
Cannot mock a module with jest, and test function calls
I wrote a React component that I'm trying to test. The component is requiring another javascript file, exposing a function. My search.js file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found