Home / File/ page.spec.ts — react Source File

page.spec.ts — react Source File

Architecture documentation for page.spec.ts, a typescript file in the react codebase. 4 imports, 0 dependents.

File typescript TestingUtilities E2E 4 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  3731bab4_20a8_fd29_7439_f961f8964da4["page.spec.ts"]
  200e1d7d_8772_57b3_072e_509f07464987["index.ts"]
  3731bab4_20a8_fd29_7439_f961f8964da4 --> 200e1d7d_8772_57b3_072e_509f07464987
  f69df4a5_0121_dc26_8c32_aacc01afafd1["defaultStore.ts"]
  3731bab4_20a8_fd29_7439_f961f8964da4 --> f69df4a5_0121_dc26_8c32_aacc01afafd1
  6ff36ea7_38cf_b0c1_f21e_5c971ac22aeb["test"]
  3731bab4_20a8_fd29_7439_f961f8964da4 --> 6ff36ea7_38cf_b0c1_f21e_5c971ac22aeb
  2c31fc2d_8ad7_2757_84a0_d1d78436c41b["prettier"]
  3731bab4_20a8_fd29_7439_f961f8964da4 --> 2c31fc2d_8ad7_2757_84a0_d1d78436c41b
  style 3731bab4_20a8_fd29_7439_f961f8964da4 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.
 */

import {expect, test, type Page} from '@playwright/test';
import {encodeStore, type Store} from '../../lib/stores';
import {defaultConfig} from '../../lib/defaultStore';
import {format} from 'prettier';

function isMonacoLoaded(): boolean {
  return (
    typeof window['MonacoEnvironment'] !== 'undefined' &&
    window['__MONACO_LOADED__'] === true
  );
}

function formatPrint(data: Array<string>): Promise<string> {
  return format(data.join(''), {parser: 'babel'});
}

async function expandConfigs(page: Page): Promise<void> {
  const expandButton = page.locator('[title="Expand config editor"]');
  await expandButton.click();
  await page.waitForSelector('.monaco-editor-config', {state: 'visible'});
}

const TEST_SOURCE = `export default function TestComponent({ x }) {
  return <Button>{x}</Button>;
}`;

const TEST_CASE_INPUTS = [
  {
    name: 'module-scope-use-memo',
    input: `
'use memo';
export default function TestComponent({ x }) {
  return <Button>{x}</Button>;
}`,
  },
  {
    name: 'module-scope-use-no-memo',
    input: `
'use no memo';
export default function TestComponent({ x }) {
  return <Button>{x}</Button>;
}`,
  },
  {
    name: 'use-memo',
    input: `
function TestComponent({ x }) {
  'use memo';
  return <Button>{x}</Button>;
}
const TestComponent2 = ({ x }) => {
  'use memo';
  return <Button>{x}</Button>;
// ... (315 more lines)

Subdomains

Dependencies

Frequently Asked Questions

What does page.spec.ts do?
page.spec.ts is a source file in the react codebase, written in typescript. It belongs to the TestingUtilities domain, E2E subdomain.
What functions are defined in page.spec.ts?
page.spec.ts defines 3 function(s): expandConfigs, formatPrint, isMonacoLoaded.
What does page.spec.ts depend on?
page.spec.ts imports 4 module(s): defaultStore.ts, index.ts, prettier, test.
Where is page.spec.ts in the architecture?
page.spec.ts is located at compiler/apps/playground/__tests__/e2e/page.spec.ts (domain: TestingUtilities, subdomain: E2E, directory: compiler/apps/playground/__tests__/e2e).

Analyze Your Own Codebase

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

Try Supermodel Free