Home / File/ transform-test-gate-pragma-test.js — react Source File

transform-test-gate-pragma-test.js — react Source File

Architecture documentation for transform-test-gate-pragma-test.js, a javascript file in the react codebase.

Entity Profile

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
'use strict';

describe('transform-test-gate-pragma', () => {
  // Fake runtime
  // eslint-disable-next-line no-unused-vars
  const _test_gate = (gateFn, testName, cb) => {
    // eslint-disable-next-line jest/no-done-callback, jest/valid-title
    it(testName, (...args) => {
      shouldPass = gateFn(context);
      return cb(...args);
    });
  };

  // eslint-disable-next-line no-unused-vars
  const _test_gate_focus = (gateFn, testName, cb) => {
    // NOTE: Tests in this file are not actually focused because the calls to
    // `test.only` and `fit` are compiled to `_test_gate_focus`. So if you want
    // to focus something, swap the following `test` call for `test.only`.
    // eslint-disable-next-line jest/no-done-callback, jest/valid-title
    it(testName, (...args) => {
      shouldPass = gateFn(context);
      isFocused = true;
      return cb(...args);
    });
  };

  // Feature flags, environment variables, etc. We can configure this in
  // our test set up.
  const context = {
    flagThatIsOff: false,
    flagThatIsOn: true,
    environment: 'fake-environment',
  };

  let shouldPass;
  let isFocused;
  beforeEach(() => {
    shouldPass = null;
    isFocused = false;
  });

  it('no pragma', () => {
    expect(shouldPass).toBe(null);
  });

  // unrelated comment
  it('no pragma, unrelated comment', () => {
    expect(shouldPass).toBe(null);
  });

  // @gate flagThatIsOn
  it('basic positive test', () => {
    expect(shouldPass).toBe(true);
  });
// ... (169 more lines)

Frequently Asked Questions

What does transform-test-gate-pragma-test.js do?
transform-test-gate-pragma-test.js is a source file in the react codebase, written in javascript.
Where is transform-test-gate-pragma-test.js in the architecture?
transform-test-gate-pragma-test.js is located at scripts/babel/__tests__/transform-test-gate-pragma-test.js (directory: scripts/babel/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free