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

xit and xdescribe do not mark tasks as pending #784

Closed
mbrio opened this issue Mar 10, 2016 · 6 comments
Closed

xit and xdescribe do not mark tasks as pending #784

mbrio opened this issue Mar 10, 2016 · 6 comments

Comments

@mbrio
Copy link
Contributor

mbrio commented Mar 10, 2016

I notice that the latest versions of Jest defaults to Jasmine 2 but for some reason xit and xdescribe do not mark tests as pending. Is this by design? Is there a way of writing pending tests?

@cpojer
Copy link
Member

cpojer commented Mar 10, 2016

Hello, I'm not sure what "pending" means but an x in front of it or describe will disable the test. I think Jest counts disabled tests so and they'll show up as passed tests even though they are disabled.

@cpojer cpojer closed this as completed Mar 10, 2016
@mbrio
Copy link
Contributor Author

mbrio commented Mar 10, 2016

Hi @cpojer, I guess it depends on how your feature parity is with the test runner you're using. Jasmine2 is the default test runner for the latest version of Jest. Jasmine2 and Jest handle xit and xdescribe differently. In Jest, if I've marked a test as xit, or have not placed a function within an it callback, the tests pass:

describe('some tests', () => {  
  xit('not ready to write out the code for the test, but I know this test should pass');
  it('not ready to write out the code for the test either, but I know this test should pass');
});

The above tests would pass under Jest, but when run under Jasmine2 they show up as pending, instead of passed. I've attached screenshots:

Jasmine displays at the bottom 3 specs, 0 failures, 2 pending:

screen shot 2016-03-10 at 3 44 15 pm

While Jest displays at the bottom 3 tests passed:

screen shot 2016-03-10 at 3 45 14 pm

I believe this is a significant difference and should be addressed. There are times when you're working on a team and a set of tests are written up as text before any code is written, it's good to know how many tests are awaiting bodies.

@cpojer cpojer reopened this Mar 10, 2016
@cpojer
Copy link
Member

cpojer commented Mar 10, 2016

@mbrio I see. I wasn't aware of the difference between Jasmine's reporting and Jest's reporting. We never reported pending tests before (not even when Jasmine 1 was the default). Would you be interested in fixing the reporting around this so that at the end we say 2 passed, 1 pending, for example? :)

@mbrio
Copy link
Contributor Author

mbrio commented Mar 10, 2016

Ha! I'll check it out tomorrow, I'll see what I can do.

@cpojer
Copy link
Member

cpojer commented Mar 11, 2016

Fixed by #788

@cpojer cpojer closed this as completed Mar 11, 2016
ghost pushed a commit that referenced this issue Mar 11, 2016
Summary:As of Jasmine2 there is the possibility to determine whether a task is pending or not. This allows for those pending tasks to output with a custom yellow icon (\u25CB small white circle ○) in verbose mode and yellow pending information in the summary line.

You can set tests as pending in Jasmine2 by using `xit()`, `xdescribe()`, `pending()`, or by not passing a function to `describe()`, `it()`, `pit()`, `fit()`, etc.

```
describe('AwesomeClass', () => {
  xit('going to write tests one day');
  pit('going to write tests one day');
  it('going to write tests one day');
  fit('going to write tests one day');
});
```

This can not work for Jasmine1 because it does not output the tasks with any form of pending information.

fixes #784
Closes #788

Differential Revision: D3039885

fb-gh-sync-id: 3e502bb0af47c7e1854f4b7d2a277c7ec29ad102
shipit-source-id: 3e502bb0af47c7e1854f4b7d2a277c7ec29ad102
@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 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants