[engine] PurityLint: Load ESLint once in beforeAll so a cold start under load cannot time out the first case
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
import { ESLint } from 'eslint';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { beforeAll, describe, expect, it } from 'vitest';
|
||||
|
||||
const repoRoot = fileURLToPath(new URL('../../..', import.meta.url));
|
||||
const eslint = new ESLint({ cwd: repoRoot });
|
||||
@@ -42,6 +42,12 @@ const IMPURE: readonly [what: string, code: string][] = [
|
||||
];
|
||||
|
||||
describe('engine purity lint rule', () => {
|
||||
// The first lint loads the config and typescript-eslint. On a busy machine that
|
||||
// alone took over vitest's 5 s, failing whichever case ran first. Pay it here.
|
||||
beforeAll(async () => {
|
||||
await messages('export {};', ENGINE_FILE);
|
||||
}, 60_000);
|
||||
|
||||
it.each(IMPURE)('reports %s inside packages/engine/src', async (_what, code) => {
|
||||
const found = await messages(code, ENGINE_FILE);
|
||||
expect(found.filter((m) => m.startsWith('fatal')), 'snippet must parse').toEqual([]);
|
||||
|
||||
Reference in New Issue
Block a user