Home / File/ moduleFilters-test.js — react Source File

moduleFilters-test.js — react Source File

Architecture documentation for moduleFilters-test.js, a javascript file in the react codebase. 2 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  be4fdda3_5115_a130_e567_6efc2cb1e5a7["moduleFilters-test.js"]
  efac6299_4c18_f347_3941_cc54822e7b6f["moduleFilters.js"]
  be4fdda3_5115_a130_e567_6efc2cb1e5a7 --> efac6299_4c18_f347_3941_cc54822e7b6f
  4b8ff33d_f91f_6a04_31db_7d18423189ad["isInternalModule"]
  be4fdda3_5115_a130_e567_6efc2cb1e5a7 --> 4b8ff33d_f91f_6a04_31db_7d18423189ad
  style be4fdda3_5115_a130_e567_6efc2cb1e5a7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

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.
 *
 * @flow
 */

import {isInternalModule} from '../moduleFilters';

describe('isInternalModule', () => {
  let map;

  function createFlamechartStackFrame(scriptUrl, locationLine, locationColumn) {
    return {
      name: 'test',
      timestamp: 0,
      duration: 1,
      scriptUrl,
      locationLine,
      locationColumn,
    };
  }

  function createStackFrame(fileName, lineNumber, columnNumber) {
    return {
      columnNumber: columnNumber,
      lineNumber: lineNumber,
      fileName: fileName,
      functionName: 'test',
      source: `    at test (${fileName}:${lineNumber}:${columnNumber})`,
    };
  }

  beforeEach(() => {
    map = new Map();
    map.set('foo', [
      [createStackFrame('foo', 10, 0), createStackFrame('foo', 15, 100)],
    ]);
    map.set('bar', [
      [createStackFrame('bar', 10, 0), createStackFrame('bar', 15, 100)],
      [createStackFrame('bar', 20, 0), createStackFrame('bar', 25, 100)],
    ]);
  });

  it('should properly identify stack frames within the provided module ranges', () => {
    expect(
      isInternalModule(map, createFlamechartStackFrame('foo', 10, 0)),
    ).toBe(true);
    expect(
      isInternalModule(map, createFlamechartStackFrame('foo', 12, 35)),
    ).toBe(true);
    expect(
      isInternalModule(map, createFlamechartStackFrame('foo', 15, 100)),
    ).toBe(true);
    expect(
      isInternalModule(map, createFlamechartStackFrame('bar', 12, 0)),
    ).toBe(true);
    expect(
      isInternalModule(map, createFlamechartStackFrame('bar', 22, 125)),
    ).toBe(true);
  });

  it('should properly identify stack frames outside of the provided module ranges', () => {
    expect(isInternalModule(map, createFlamechartStackFrame('foo', 9, 0))).toBe(
      false,
    );
    expect(
      isInternalModule(map, createFlamechartStackFrame('foo', 15, 101)),
    ).toBe(false);
    expect(
      isInternalModule(map, createFlamechartStackFrame('bar', 17, 0)),
    ).toBe(false);
    expect(
      isInternalModule(map, createFlamechartStackFrame('baz', 12, 0)),
    ).toBe(false);
  });
});

Domain

Frequently Asked Questions

What does moduleFilters-test.js do?
moduleFilters-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does moduleFilters-test.js depend on?
moduleFilters-test.js imports 2 module(s): isInternalModule, moduleFilters.js.
Where is moduleFilters-test.js in the architecture?
moduleFilters-test.js is located at packages/react-devtools-timeline/src/content-views/utils/__tests__/moduleFilters-test.js (domain: BabelCompiler, directory: packages/react-devtools-timeline/src/content-views/utils/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free