'use strict'; // Local-only performance regression probe. It compares the committed 1.2.4 // sources with the working tree without rewriting dist or visiting an account. const test = require('node:test'); const assert = require('node:assert/strict'); const fs = require('node:fs'); const path = require('node:path'); const os = require('node:os'); const http = require('node:http'); const { execFileSync } = require('node:child_process'); const ROOT = path.resolve(__dirname, '..'); const DATASET = path.join(ROOT, '题库/华谊集团化工总控工(高级)-合并题库.json'); const OUTPUT = path.join(os.tmpdir(), 'huayi-qb-performance'); const RECORDS_KEY = 'huayi-qb.records.v1'; const SOURCES = ['src/core.js', 'src/adapter.js', 'src/autofill.js', 'src/app.js']; // This was HEAD/package version 1.2.4 when the reported regression was captured. // Pin it so committing the fix does not silently turn the baseline into itself. const BASELINE_REF = process.env.QB_PERF_BASE_REF || '26e0a920b6d56603bfee1061014c5052a7366ec2'; function loadPlaywright() { if (process.env.QB_PLAYWRIGHT_MODULE) return require(process.env.QB_PLAYWRIGHT_MODULE); try { return require('playwright'); } catch (_) { return require(path.join(os.homedir(), '.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright')); } } function browserOptions() { const requested = process.env.QB_CHROMIUM_EXECUTABLE || process.env.QB_CHROMIUM_PATH; const cached = path.join(os.homedir(), 'AppData/Local/ms-playwright/chromium_headless_shell-1228/chrome-headless-shell-win64/chrome-headless-shell.exe'); return { headless: true, ...(requested || fs.existsSync(cached) ? { executablePath: requested || cached } : {}) }; } function html(value) { return String(value).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); } function fixture(record) { const title = html(record.bankName); const inputs = record.options.map(option => ``).join(''); return `
本地性能回归:1884 道题库记录,面板保持隐藏。
页面计时器:0