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:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user