Add Prettier and ESLint tooling (Refs #77)
This commit is contained in:
+15
-5
@@ -1,5 +1,13 @@
|
||||
import { describe, expect, it, beforeEach, afterEach } from 'vitest';
|
||||
import { appendFileSync, mkdirSync, renameSync, rmSync, statSync, utimesSync, writeFileSync } from 'node:fs';
|
||||
import {
|
||||
appendFileSync,
|
||||
mkdirSync,
|
||||
renameSync,
|
||||
rmSync,
|
||||
statSync,
|
||||
utimesSync,
|
||||
writeFileSync
|
||||
} from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { tmpdir } from 'node:os';
|
||||
|
||||
@@ -12,9 +20,8 @@ process.env.REL_DEST = 'runtime/plutonium/storage/t5/raw/scripts/sp';
|
||||
process.env.BETA_ARCHIVE_DIR = resolve(TMP_ROOT, 'beta-archive');
|
||||
process.env.DB_PATH = resolve(TMP_ROOT, 'test.db');
|
||||
|
||||
const { resolveLogPath, tailLog, readLogChunk, isLogKey } = await import(
|
||||
'../../src/lib/server/fleet/logs.js'
|
||||
);
|
||||
const { resolveLogPath, tailLog, readLogChunk, isLogKey } =
|
||||
await import('../../src/lib/server/fleet/logs.js');
|
||||
|
||||
const SERVER = 't5_zombie_theater_1';
|
||||
const LOG_DIR = resolve(TMP_ROOT, SERVER, 'logs');
|
||||
@@ -75,7 +82,10 @@ describe('tailLog', () => {
|
||||
const path = resolve(LOG_DIR, 'big.log');
|
||||
// 500 KB of 60-char lines — comfortably larger than the 256 KB read window.
|
||||
const line = 'x'.repeat(59);
|
||||
const body = Array.from({ length: 8500 }, (_, i) => `${i.toString().padStart(4, '0')}${line.slice(4)}`).join('\n');
|
||||
const body = Array.from(
|
||||
{ length: 8500 },
|
||||
(_, i) => `${i.toString().padStart(4, '0')}${line.slice(4)}`
|
||||
).join('\n');
|
||||
writeFileSync(path, body);
|
||||
|
||||
const tail = await tailLog(path, 100);
|
||||
|
||||
Reference in New Issue
Block a user