Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: test.skip/only/todo aliases #1605

Closed
kentcdodds opened this issue Sep 4, 2016 · 19 comments
Closed

Feature: test.skip/only/todo aliases #1605

kentcdodds opened this issue Sep 4, 2016 · 19 comments

Comments

@kentcdodds
Copy link
Contributor

Thanks for Jest!

I'm basically looking for the same functionality that AVA has:

There's also a handy test.failing feature. I've never used it, but I can see how it could be valuable!

@quantizor
Copy link
Contributor

Skip is the same as xit / xdescribe, and only is equivalent to fit, AFAIK. You can write a test stub without filling it in, which I guess is equivalent to todo.

@kentcdodds
Copy link
Contributor Author

Cool, thanks for the info. But what if I prefer the test global over it?

@quantizor
Copy link
Contributor

You don't have to use Jasmine, believe it supports swapping out the env to something like TAP if you prefer.

@kentcdodds
Copy link
Contributor Author

True, but why can't we just add these things? I don't see any harm in doing so... If the test alias is already available, may as well make it behave as expected right?

@quantizor
Copy link
Contributor

Increasing the API surface area just because you personally want something is kind of unreasonable, IMO. The Jest team specifically built in those escape hatches for people like yourself that want further customization.

@kentcdodds
Copy link
Contributor Author

Right, and what I'm suggesting is the idea of least surprise. Because the escape hatch exists, it's surprising to me that it doesn't behave as expected.

I'm done bikeshedding. I'll wait for a member of the project to comment.

@adriantoine
Copy link

adriantoine commented Sep 5, 2016

I'm switching some of my projets from AVA to Jest (still like AVA but Jest has a better "out-of-the-box" support for React/UI components IMO) and I miss some of those as well!

only is actually a very useful one, when developing you usually focus on writing one test and that cleans up the output.

todo is also very useful as I like to plan my tests in advance, I usually write a bunch test.todo and as I write them AVA nicely shows my progress. For now I'm writing empty tests in Jest:

it('does stuff ', () => {

});

but Jest displays those as successful tests which is not really what I want, it doesn't help much with my organisation.

Those features are not that important but nice to have and will greatly improve the general developer experience 😊

@aaronabramov
Copy link
Contributor

i really wanted those too. I aliased some of them here
#1632

failing and todo seem to be pretty awesome too, but the'll require a little more code :)

@cpojer
Copy link
Member

cpojer commented Sep 7, 2016

I don't see value in test.failing it seems too easy to forget to fix them.

test.todo I'm ok with, should be easy to implement as test.todo = title => xit(title, () => {}).

@kentcdodds
Copy link
Contributor Author

I don't see value in test.failing it seems too easy to forget to fix them.

I'm ok to leave that one off. I've never really used it before.

@cpojer cpojer added this to the 15.2.0 milestone Sep 14, 2016
@cpojer
Copy link
Member

cpojer commented Sep 14, 2016

@DmitriiAbramov test.todo seems easy enough to add. Do you mind helping with this since you already added all the other ones from this issue?

@kellyrmilligan
Copy link

the docs seem to say that test.skip() is available now, is that not the case? I can just use xit insead for now, but it was confusing. jest version 15.1.1 says it.skip is not a function.

@cpojer
Copy link
Member

cpojer commented Sep 20, 2016

ah, we accidentally pushed the website but not a release yet. There'll be a new release in the next few days.

@cpojer
Copy link
Member

cpojer commented Sep 23, 2016

This will be in 16: #1775

@adriantoine
Copy link

Nice!

@SimenB
Copy link
Member

SimenB commented Oct 8, 2017

@cpojer are you still opposed to test.failing?

I find it an awesome way to keep around todos in the code itself, instead of in issues (or docs). I may know how I want something to behave, even though I'm unable/don't have the time to implement it right away. When I feel like hacking around, I can just grep for .failing and see if there are any low-hanging fruit. If tests are already written, it's a head start

Another use case, which is highlighted in Ava's docs, is that people can contribute failing tests for expected behavior as a separate thing from fixing it.

I can implement this if it's going to be accepted, but don't want to spend time on it since you've said in this issue you don't want it.

@cpojer
Copy link
Member

cpojer commented Oct 8, 2017

@SimenB yeah, I'm fine with it.

@SimenB
Copy link
Member

SimenB commented Oct 8, 2017

Cool! I've spun up a separate issue for it as this has been closed for a year. #4627

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants