Skip to content

Commit

Permalink
Enabled DebugTracing flag for variant tests
Browse files Browse the repository at this point in the history
And fix a few tests that had gotten stale.
  • Loading branch information
Brian Vaughn committed Oct 1, 2020
1 parent 5427b46 commit 83199cb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,23 @@ describe('DebugTracing', () => {
expect(Scheduler).toFlushUntilNextPaint([]);
}).toErrorDev('Cannot update during an existing state transition');

expect(logs).toEqual([
'group: ⚛️ render (0b0000000000000000000001000000000)',
'log: ⚛️ Example updated state (0b0000000000000000000010000000000)',
'log: ⚛️ Example updated state (0b0000000000000000000010000000000)',
'groupEnd: ⚛️ render (0b0000000000000000000001000000000)',
]);
gate(flags => {
if (flags.new) {
expect(logs).toEqual([
'group: ⚛️ render (0b0000000000000000000001000000000)',
'log: ⚛️ Example updated state (0b0000000000000000000001000000000)',
'log: ⚛️ Example updated state (0b0000000000000000000001000000000)',
'groupEnd: ⚛️ render (0b0000000000000000000001000000000)',
]);
} else {
expect(logs).toEqual([
'group: ⚛️ render (0b0000000000000000000001000000000)',
'log: ⚛️ Example updated state (0b0000000000000000000010000000000)',
'log: ⚛️ Example updated state (0b0000000000000000000010000000000)',
'groupEnd: ⚛️ render (0b0000000000000000000001000000000)',
]);
}
});
});

// @gate experimental && build === 'development' && enableDebugTracing
Expand Down Expand Up @@ -274,12 +285,24 @@ describe('DebugTracing', () => {
{unstable_isConcurrent: true},
);
});
expect(logs).toEqual([
'group: ⚛️ render (0b0000000000000000000001000000000)',
'log: ⚛️ Example updated state (0b0000000000000000000010000000000)',
'log: ⚛️ Example updated state (0b0000000000000000000010000000000)', // debugRenderPhaseSideEffectsForStrictMode
'groupEnd: ⚛️ render (0b0000000000000000000001000000000)',
]);

gate(flags => {
if (flags.new) {
expect(logs).toEqual([
'group: ⚛️ render (0b0000000000000000000001000000000)',
'log: ⚛️ Example updated state (0b0000000000000000000001000000000)',
'log: ⚛️ Example updated state (0b0000000000000000000001000000000)', // debugRenderPhaseSideEffectsForStrictMode
'groupEnd: ⚛️ render (0b0000000000000000000001000000000)',
]);
} else {
expect(logs).toEqual([
'group: ⚛️ render (0b0000000000000000000001000000000)',
'log: ⚛️ Example updated state (0b0000000000000000000010000000000)',
'log: ⚛️ Example updated state (0b0000000000000000000010000000000)', // debugRenderPhaseSideEffectsForStrictMode
'groupEnd: ⚛️ render (0b0000000000000000000001000000000)',
]);
}
});
});

// @gate experimental && build === 'development' && enableDebugTracing
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/forks/ReactFeatureFlags.www-dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const enableEagerRootListeners = !__VARIANT__;
// It logs information to the console about React scheduling, rendering, and commit phases.
//
// NOTE: This feature will only work in DEV mode; all callsights are wrapped with __DEV__.
export const enableDebugTracing = false;
export const enableDebugTracing = __EXPERIMENTAL__;

// This only has an effect in the new reconciler. But also, the new reconciler
// is only enabled when __VARIANT__ is true. So this is set to the opposite of
Expand Down

0 comments on commit 83199cb

Please sign in to comment.