test(search): reject readFile errors in #2444 fixture loader

beforeAll always resolved the readFile promise with data even when
err was set, which led to calling toString on undefined. Reject the
promise on err so fixture load failures surface clearly. Use res/rej
callback names to avoid shadowing path.resolve.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Daniel Imms
2026-06-01 15:29:07 +00:00
committed by Cursor Agent
co-authored by Cursor
parent 92a1bfcf2e
commit a9a2a8e3c1
+1 -1
View File
@@ -417,7 +417,7 @@ test.describe('Search Tests', () => {
test.describe('#2444 wrapped line content not being found', () => {
let fixture: string;
test.beforeAll(async () => {
fixture = (await new Promise<Buffer>(r => readFile(resolve(__dirname, '../fixtures/issue-2444'), (err, data) => r(data)))).toString();
fixture = (await new Promise<Buffer>((res, rej) => readFile(resolve(__dirname, '../fixtures/issue-2444'), (err, data) => err ? rej(err) : res(data)))).toString();
if (process.platform !== 'win32') {
fixture = fixture.replace(/\n/g, '\n\r');
}