Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion __tests__/mpeg-ts-not-typescript.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ describe('MPEG-TS video named .ts is skipped, real TypeScript is indexed (#1910)
});
});

describe('a video .ts never stays pending (#1910)', () => {
// Each case builds a git repository and indexes it, the last one twice over. On
// Windows every git process costs ~100 ms, which puts these cases at 5–6 s there,
// past vitest's 5 s default.
describe('a video .ts never stays pending (#1910)', { timeout: 30_000 }, () => {
const dirs: string[] = [];
afterEach(() => { for (const d of dirs.splice(0)) fs.rmSync(d, { recursive: true, force: true }); });
const gitProject = (): string => {
Expand Down
13 changes: 11 additions & 2 deletions __tests__/oversize-file-not-read.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,17 @@ describe('an unchanged file over the size limit is not reported as drifted (#191
dir = fs.mkdtempSync(path.join(os.tmpdir(), 'codegraph-oversize-drift-'));
fs.writeFileSync(path.join(dir, 'app.ts'), 'export function alpha() { return 1; }\n');
// 1.4 MB of ordinary text: over the index limit, under the viewer's 8 MB read cap.
const line = 'const x = 1;\n';
fs.writeFileSync(path.join(dir, 'big.js'), line.repeat(Math.ceil((1.4 * 1024 * 1024) / line.length)));
// Each line differs: Windows Defender's script scan of a freshly written `.js`
// made of one statement repeated 110k times takes close to a minute on the
// first read, so the viewer's read below blew the test timeout there. Real
// code of the same size is scanned in milliseconds.
const line = 'const last = 0;\n';
const lines: string[] = [];
for (let size = 0, i = 0; size < 1.4 * 1024 * 1024; i++) {
lines.push(`const x${i} = ${i};\n`);
size += lines[i]!.length;
}
fs.writeFileSync(path.join(dir, 'big.js'), lines.join(''));
const cg = await CodeGraph.init(dir, { index: true });
try {
const record = cg.getFiles().find((f) => f.path === 'big.js')!;
Expand Down