mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-05-10 22:31:05 -07:00
fix(lint): fix calibration script lint errors
- Rename run-e2e-calibration.ts to run-end-to-end-calibration.ts (unicorn/prevent-abbreviations) - Fix import order (fs-extra before node:child_process) - Fix formatting (remove extra spaces, add trailing commas) - Use void operator for floating promise (no-floating-promises) - Update package.json script reference
This commit is contained in:
parent
c611ec5197
commit
c82be64705
2 changed files with 15 additions and 15 deletions
|
|
@ -20,7 +20,7 @@
|
|||
"test:unit": "cross-env ELECTRON_RUN_AS_NODE=1 ./node_modules/.bin/electron --max-old-space-size=8192 ./node_modules/vitest/vitest.mjs run",
|
||||
"test:unit:coverage": "pnpm run test:unit --coverage",
|
||||
"test:prepare-e2e": "cross-env READ_DOC_BEFORE_USING='docs/Testing.md' && pnpm run clean && pnpm run build:plugin && cross-env NODE_ENV=test DEBUG=electron-forge:* electron-forge package",
|
||||
"test:e2e:calibration": "rimraf -- ./test-artifacts && cross-env NODE_ENV=test tsx scripts/developmentMkdir.ts && cross-env NODE_ENV=test tsx scripts/error-to-error-preflight.ts && cross-env NODE_ENV=test tsx scripts/run-e2e-calibration.ts",
|
||||
"test:e2e:calibration": "rimraf -- ./test-artifacts && cross-env NODE_ENV=test tsx scripts/developmentMkdir.ts && cross-env NODE_ENV=test tsx scripts/error-to-error-preflight.ts && cross-env NODE_ENV=test tsx scripts/run-end-to-end-calibration.ts",
|
||||
"test:e2e": "rimraf -- ./test-artifacts && cross-env NODE_ENV=test tsx scripts/developmentMkdir.ts && cross-env NODE_ENV=test tsx scripts/error-to-error-preflight.ts && cross-env NODE_ENV=test cucumber-js --config features/cucumber.config.js --exit",
|
||||
"test:manual-e2e": "pnpm exec cross-env SHOW_E2E_WINDOW=1 NODE_ENV=test tsx ./scripts/start-e2e-app.ts",
|
||||
"make": "pnpm run build:plugin && cross-env NODE_ENV=production electron-forge make",
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@
|
|||
* This script runs before the full E2E suite to dynamically calculate timeout multipliers.
|
||||
*/
|
||||
|
||||
import { execSync } from 'child_process';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { execSync } from 'node:child_process';
|
||||
import path from 'node:path';
|
||||
|
||||
const CALIBRATION_FILE = path.resolve(process.cwd(), 'test-artifacts', '.calibration.json');
|
||||
|
||||
async function runCalibration() {
|
||||
console.log('[E2E Calibration] Starting calibration smoke test...');
|
||||
|
||||
|
||||
const startTime = Date.now();
|
||||
|
||||
|
||||
try {
|
||||
// Run smoke test with calibration profile
|
||||
execSync(
|
||||
|
|
@ -26,18 +26,18 @@ async function runCalibration() {
|
|||
NODE_ENV: 'test',
|
||||
TIDGI_E2E_IS_CALIBRATION: 'true',
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
const duration = Date.now() - startTime;
|
||||
console.log(`[E2E Calibration] Smoke test completed in ${duration}ms`);
|
||||
|
||||
|
||||
// Calculate multiplier
|
||||
const REFERENCE_DURATION_MS = 8000; // Reference from GitHub Actions
|
||||
const MAX_MULTIPLIER = 5.0;
|
||||
const rawMultiplier = duration / REFERENCE_DURATION_MS;
|
||||
const multiplier = Math.min(MAX_MULTIPLIER, Math.max(1.0, rawMultiplier));
|
||||
|
||||
|
||||
// Write calibration result
|
||||
await fs.ensureDir(path.dirname(CALIBRATION_FILE));
|
||||
await fs.writeJson(
|
||||
|
|
@ -47,19 +47,19 @@ async function runCalibration() {
|
|||
multiplier,
|
||||
recordedAt: Date.now(),
|
||||
},
|
||||
{ spaces: 2 }
|
||||
{ spaces: 2 },
|
||||
);
|
||||
|
||||
|
||||
console.log(`[E2E Calibration] Performance multiplier: ${multiplier.toFixed(2)}×`);
|
||||
console.log(`[E2E Calibration] Calibration file written to: ${CALIBRATION_FILE}`);
|
||||
|
||||
|
||||
// Calculate expected timeout for workflow
|
||||
const BASE_TIMEOUT_MS = 25000;
|
||||
const SCENARIO_COUNT = 65; // Approximate, update as suite grows
|
||||
const expectedTimeoutMinutes = Math.ceil((BASE_TIMEOUT_MS * multiplier * SCENARIO_COUNT) / 60000);
|
||||
|
||||
|
||||
console.log(`[E2E Calibration] Recommended workflow timeout: ${expectedTimeoutMinutes} minutes`);
|
||||
|
||||
|
||||
return 0;
|
||||
} catch (error) {
|
||||
console.error('[E2E Calibration] Calibration failed:', error);
|
||||
|
|
@ -68,4 +68,4 @@ async function runCalibration() {
|
|||
}
|
||||
}
|
||||
|
||||
runCalibration().then(code => process.exit(code));
|
||||
void runCalibration().then((code) => process.exit(code));
|
||||
Loading…
Add table
Add a link
Reference in a new issue