CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
test-setup.ts39 linesDownload Raw Back to cli
1/**2 * @license3 * Copyright 2025 Google LLC4 * SPDX-License-Identifier: Apache-2.05 */6 7// Unset NO_COLOR environment variable to ensure consistent theme behavior between local and CI test runs8if (process.env['NO_COLOR'] !== undefined) {9  delete process.env['NO_COLOR'];10}11 12// Avoid writing per-session debug log files during CLI tests.13// Individual tests can still opt in by overriding this env var explicitly.14if (process.env['QWEN_DEBUG_LOG_FILE'] === undefined) {15  process.env['QWEN_DEBUG_LOG_FILE'] = '0';16}17 18import './src/test-utils/customMatchers.js';19 20// Lowlight is loaded asynchronously in production to keep it out of the21// startup-critical bundle chunk. Snapshot tests render synchronously via22// `lastFrame()` and would otherwise capture the plain-text fallback before23// the dynamic import resolves. Prime the cache once here so every test sees24// the fully-highlighted output. The loader is intentionally a tiny standalone25// module (no transitive imports of themeManager / settings / core) so this26// prime does not perturb any other test's module graph.27import { loadLowlight } from './src/ui/utils/lowlightLoader.js';28try {29  await loadLowlight();30} catch (err) {31  // Don't crash the entire test run if lowlight fails to import; snapshot32  // tests that hit a code block will then render the plain-text fallback.33  console.warn(34    '[test-setup] Failed to prime lowlight cache, snapshot tests may ' +35      'show plain-text fallback:',36    String(err),37  );38}39 
basant307/AI_Governance_Project · CoolFace