Skip to content

Commit

Permalink
Add more test gating to fix broken targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Apr 16, 2020
1 parent 76f26f6 commit c3a2c4b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ describe('ReactDOMServerIntegration', () => {
});

// Test pragmas don't support itRenders abstraction
if (require('shared/ReactFeatureFlags').enableDebugTracing) {
if (
__EXPERIMENTAL__ &&
require('shared/ReactFeatureFlags').enableDebugTracing
) {
describe('React.DebugTracingMode', () => {
beforeEach(() => {
spyOnDevAndProd(console, 'log');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('DebugTracing', () => {
});
});

// @gate experimental
it('should not log anything for sync render without suspends or state updates', () => {
ReactTestRenderer.create(
<React.DebugTracingMode>
Expand All @@ -50,8 +51,14 @@ describe('DebugTracing', () => {
expect(logs).toEqual([]);
});

// @gate experimental
it('should not log anything for concurrent render without suspends or state updates', () => {
ReactTestRenderer.create(<div />, {unstable_isConcurrent: true});
ReactTestRenderer.create(
<React.DebugTracingMode>
<div />
</React.DebugTracingMode>,
{unstable_isConcurrent: true},
);

expect(logs).toEqual([]);

Expand All @@ -62,7 +69,7 @@ describe('DebugTracing', () => {
expect(logs).toEqual([]);
});

// @gate enableDebugTracing
// @gate experimental && enableDebugTracing
it('should log sync render with suspense', async () => {
const fakeSuspensPromise = Promise.resolve(true);
function Example() {
Expand All @@ -89,7 +96,7 @@ describe('DebugTracing', () => {
expect(logs).toEqual(['log: ⚛️ Example resolved']);
});

// @gate enableDebugTracing
// @gate experimental && enableDebugTracing
it('should log concurrent render with suspense', async () => {
const fakeSuspensPromise = Promise.resolve(true);
function Example() {
Expand Down Expand Up @@ -123,7 +130,7 @@ describe('DebugTracing', () => {
expect(logs).toEqual(['log: ⚛️ Example resolved']);
});

// @gate enableDebugTracing
// @gate experimental && enableDebugTracing
it('should log cascading class component updates', () => {
class Example extends React.Component {
state = {didMount: false};
Expand Down Expand Up @@ -157,7 +164,7 @@ describe('DebugTracing', () => {
]);
});

// @gate enableDebugTracing
// @gate experimental && enableDebugTracing
it('should log render phase state updates for class component', () => {
class Example extends React.Component {
state = {didRender: false};
Expand Down Expand Up @@ -192,7 +199,7 @@ describe('DebugTracing', () => {
]);
});

// @gate enableDebugTracing
// @gate experimental && enableDebugTracing
it('should log cascading layout updates', () => {
function Example() {
const [didMount, setDidMount] = React.useState(false);
Expand Down Expand Up @@ -224,7 +231,7 @@ describe('DebugTracing', () => {
]);
});

// @gate enableDebugTracing
// @gate experimental && enableDebugTracing
it('should log cascading passive updates', () => {
function Example() {
const [didMount, setDidMount] = React.useState(false);
Expand All @@ -249,7 +256,7 @@ describe('DebugTracing', () => {
]);
});

// @gate enableDebugTracing
// @gate experimental && enableDebugTracing
it('should log render phase updates', () => {
function Example() {
const [didRender, setDidRender] = React.useState(false);
Expand All @@ -275,7 +282,7 @@ describe('DebugTracing', () => {
]);
});

// @gate enableDebugTracing
// @gate experimental && enableDebugTracing
it('should log when user code logs', () => {
function Example() {
console.log('Hello from user code');
Expand All @@ -302,6 +309,7 @@ describe('DebugTracing', () => {
]);
});

// @gate experimental
it('should not log anything outside of a DebugTracingMode subtree', () => {
function ExampleThatCascades() {
const [didMount, setDidMount] = React.useState(false);
Expand Down

0 comments on commit c3a2c4b

Please sign in to comment.