8d5a68c71e
Avoid crashing Electron at startup when sharp is corrupt, and fail pack if asarUnpack natives look truncated. Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
605 B
JavaScript
21 lines
605 B
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
|
|
import {
|
|
__resetSharpRuntimeForTests,
|
|
getSharp,
|
|
sharpLoadFailure,
|
|
} from './sharpRuntime.mjs';
|
|
|
|
void test('getSharp: loads sharp when install is healthy', () => {
|
|
__resetSharpRuntimeForTests();
|
|
const sharp = getSharp();
|
|
assert.equal(typeof sharp, 'function');
|
|
});
|
|
|
|
void test('sharpLoadFailure: includes reinstall hint', () => {
|
|
const err = sharpLoadFailure(new Error('SyntaxError: Unexpected end of input'));
|
|
assert.match(err.message, /переустановите/i);
|
|
assert.match(err.message, /SyntaxError/);
|
|
});
|