Skip to content

Experimental test helper: it.experimental#17149

Merged
acdlite merged 1 commit intofacebook:masterfrom
acdlite:it-experimental
Oct 19, 2019
Merged

Experimental test helper: it.experimental#17149
acdlite merged 1 commit intofacebook:masterfrom
acdlite:it-experimental

Conversation

@acdlite
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

sizebot commented Oct 19, 2019

Size changes (experimental)

No significant bundle size changes to report.

Generated by 🚫 dangerJS against 1c05b38

@sizebot
Copy link
Copy Markdown

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