Feature Request: Prebound assertion functions
See original GitHub issueIt would be useful and functional to be able to destructure test functions such as pass
, fail
, deepEqual
, it
etc. from the test object argument passed into the test function. Currently they are not bound to the test context but could probably be provided pre-bound.
test(({ deepEqual }) => {
deepEqual([1, 2], [1, 2]);
});
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
5. Add Assertions to Functional Tests | ReadyAPI Documentation
In Functional Tests, select GET Request in the Navigator panel and click Add Assertion: · In the dialog, select the SLA category on...
Read more >About Queries | Testing Library
This is useful for asserting an element that is not present. ... query that is pre-bound to document.body (using the within functionality).
Read more >gMock Cookbook | GoogleTest
Mocking Non-virtual Methods. gMock can mock non-virtual functions to be used in Hi-perf dependency injection. ... Using Matchers in googletest Assertions.
Read more >tap - npm
Works with all exception-throwing assertion libraries (chai, should, node's built-in require('assert') , or just throwing yourself) but also ...
Read more >Using React Testing Library and Jest with AG Grid
I want to write tests that assert AG Grid renders the expected data, ... But... ideally write a test function to cover the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
With the recent assertion refactor I think we can make it so the assertion knows whether it’s bound or not, so unbound enhanced assertions know that they’re not wrapped by
power-assert
.That said I’m somewhat concerned about the performance impact, and not convinced about the value-add.
I don’t really see how that is any more readable than:
It actually get’s very verbose when you use multiple assertions, which is common:
Let’s see what the other team members think.
Maybe you can elaborate on why you want it this way.