Skip to content

Commit bec7599

Browse files
authored
Migrate conditional tests to gate pragma (facebook#18585)
* Migrate conditional tests to gate pragma I searched through the codebase for this pattern: ```js describe('test suite', () => { if (!__EXPERIMENTAL__) { // or some other condition test("empty test so Jest doesn't complain", () => {}); return; } // Unless we're in experimental mode, none of the tests in this block // will run. }) ``` and converted them to the `@gate` pragma instead. The reason this pattern isn't preferred is because you end up disabling more tests than you need to. * Add flag for www release channels Using a heuristic where I check a flag that is known to only be enabled in www. I left a TODO to instead set the release channel explicitly in each test config.
1 parent 6c43a62 commit bec7599

30 files changed

+3500
-2928
lines changed

packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.internal.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ describe('ReactHooksInspection', () => {
2525
ReactDebugTools = require('react-debug-tools');
2626
});
2727

28-
if (!__EXPERIMENTAL__) {
29-
it("empty test so Jest doesn't complain", () => {});
30-
return;
31-
}
32-
28+
// @gate experimental
3329
it('should inspect a simple useResponder hook', () => {
3430
const TestResponder = React.DEPRECATED_createResponder('TestResponder', {});
3531

@@ -51,6 +47,7 @@ describe('ReactHooksInspection', () => {
5147
]);
5248
});
5349

50+
// @gate experimental
5451
it('should inspect a simple ReactDOM.useEvent hook', () => {
5552
let clickHandle;
5653
let ref;

packages/react-devtools-shared/src/__tests__/storeStressTestConcurrent-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('StoreStressConcurrent', () => {
2727
print = require('./storeSerializer').print;
2828
});
2929

30+
// TODO: Remove this in favor of @gate pragma
3031
if (!__EXPERIMENTAL__) {
3132
it("empty test so Jest doesn't complain", () => {});
3233
return;

0 commit comments

Comments
 (0)