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

Experimental test helper: it.experimental #17149

Merged
merged 1 commit into from
Oct 19, 2019

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Oct 19, 2019

Special version of Jest's it for experimental tests. Tests marked as experimental will run both stable and experimental modes. In experimental mode, they work the same as the normal Jest methods. In stable mode, they are expected to fail. This means we can detect when a test previously marked as experimental can be un-marked when the feature becomes stable. It also reduces the chances that we accidentally add experimental APIs to the stable builds before we intend.

I added corresponding methods for the focus and skip APIs:

  • fit -> fit.experimental
  • it.only -> it.only.experimental or it.experimental.only
  • xit -> xit.experimental
  • it.skip -> it.skip.experimental or it.experimental.skip

Since it is an alias of test, test.experimental works, too.

Here's what it will look like when a test marked as experimental passes in stable:

Screen Shot 2019-10-19 at 2 05 25 PM

I only marked a single test as experimental in this PR, to show that it works. I will convert the others in follow ups.

Special version of Jest's `it` for experimental tests. Tests marked as
experimental will run **both** stable and experimental modes. In
experimental mode, they work the same as the normal Jest methods. In
stable mode, they are **expected to fail**. This means we can detect
when a test previously marked as experimental can be un-marked when the
feature becomes stable. It also reduces the chances that we accidentally
add experimental APIs to the stable builds before we intend.

I added corresponding methods for the focus and skip APIs:

- `fit` -> `fit.experimental`
- `it.only` -> `it.only.experimental` or `it.experimental.only`
- `xit` -> `xit.experimental`
- `it.skip` -> `it.skip.experimental` or `it.experimental.skip`

Since `it` is an alias of `test`, `test.experimental` works, too.
Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

@sizebot
Copy link

sizebot commented Oct 19, 2019

Size changes (experimental)

No significant bundle size changes to report.

Generated by 🚫 dangerJS against 1c05b38

@sizebot
Copy link

sizebot commented Oct 19, 2019

Size changes (stable)

No significant bundle size changes to report.

Generated by 🚫 dangerJS against 1c05b38

@acdlite acdlite merged commit 349cf5a into facebook:master Oct 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants