test.todo should allow and ignore implementation function
See original GitHub issue🚀 Feature Proposal
I was hoping to reopen the discussion about whether test.todo
should ignore a passed in function for the second parameter rather than throwing an error.
This was discussed in original issue, but it seemed to peter out.
Motivation
I see two reasons why this could be helpful:
- For stubbing tests (see the original issue)
- The test cannot be finalised for some reason
Example
test.todo('This is a test', () => {
// something to come back to...
});
Pitch
This is an extension existing functionality.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5
Top Results From Across the Web
How to use test.todo() in Jest | heyfirst.co - First Sutham
Problem. Let's say, we have a Add to wishlist button component that will be disable if user is not logged in yet, and...
Read more >Using Jest's todo feature - Stack Overflow
For example, I want to sketch out tests in my subscriptions.test.ts file so I create the following: describe('Subscription Tests', () => { ...
Read more >Globals - Jest
Runs a function after all the tests in this file have completed. If the function returns a promise or is a generator, Jest...
Read more >7. Incomplete and Skipped Tests — PHPUnit 9.5 Manual
This misinterpretation leads to the test reports being useless – you cannot see whether a test is actually successful or just not yet...
Read more >Jest Testing like a Pro - Tips and tricks
Tests should not rely on external apis/services, they should not rely on globals or other objects that are persisted across different tests, so ......
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 FreeTop 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
Top GitHub Comments
I’m currently in the position where I want to test something that partly depends on the implementation of another package. However, the other package has some inconsistencies that are meaning its hard to write the test.
I don’t want to throw away what I have written, as intend to keep an eye on it to come back to at some point.
The alternatives that I see are to use:
test.skip
I would prefer that my code skips 0 tests by default. I often work by temporarily adding
test.only
ortest.skip
to see how things are going. But, I don’t want to leave any of these in the code by accident. So I think it’s reasonable to prefer to have 0.skips
and some.todo
s checked in.Wrap it in a describe
So the next best alternative, at least IMO, is to wrap the
todo
in a describe block:It’s okay, but I think it’s cleaner to just put it in the
todo
?@jeysal, I see what you are saying, I guess I am coming it from the other way round! I realised I missed one
only
that I missed and I didn’t catch it because of theskip
s I had.This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.