Home / File/ TestFlags.js — react Source File

TestFlags.js — react Source File

Architecture documentation for TestFlags.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

'use strict';

// These flags can be in a @gate pragma to declare that a test depends on
// certain conditions. They're like GKs.
//
// Examples:
//   // @gate enableSomeAPI
//   test('uses an unstable API', () => {/*...*/})
//
//   // @gate __DEV__
//   test('only passes in development', () => {/*...*/})
//
// Most flags are defined in ReactFeatureFlags. If it's defined there, you don't
// have to do anything extra here.
//
// There are also flags based on the environment, like __DEV__. Feel free to
// add new flags and aliases below.
//
// You can also combine flags using multiple gates:
//
//   // @gate enableSomeAPI
//   // @gate __DEV__
//   test('both conditions must pass', () => {/*...*/})
//
// Or using logical operators
//   // @gate enableSomeAPI && __DEV__
//   test('both conditions must pass', () => {/*...*/})
//
// Negation also works:
//   // @gate !deprecateLegacyContext
//   test('uses a deprecated feature', () => {/*...*/})

// These flags are based on the environment and don't change for the entire
// test run.
const environmentFlags = {
  __DEV__,
  build: __DEV__ ? 'development' : 'production',

  // TODO: Should "experimental" also imply "modern"? Maybe we should
  // always compare to the channel?
  experimental: __EXPERIMENTAL__,
  // Similarly, should stable imply "classic"?
  stable: !__EXPERIMENTAL__,

  variant: __VARIANT__,

  persistent: global.__PERSISTENT__ === true,

  // Use this for tests that are known to be broken.
  FIXME: false,
  TODO: false,

  enableUseJSStackToTrackPassiveDurations: false,
};

function getTestFlags() {
  // These are required on demand because some of our tests mutate them. We try
  // not to but there are exceptions.
  const featureFlags = require('shared/ReactFeatureFlags');
  const schedulerFeatureFlags = require('scheduler/src/SchedulerFeatureFlags');
// ... (71 more lines)

Domain

Subdomains

Functions

Frequently Asked Questions

What does TestFlags.js do?
TestFlags.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Optimization subdomain.
What functions are defined in TestFlags.js?
TestFlags.js defines 1 function(s): getTestFlags.
Where is TestFlags.js in the architecture?
TestFlags.js is located at scripts/jest/TestFlags.js (domain: BabelCompiler, subdomain: Optimization, directory: scripts/jest).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free