-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
The optional lz4 dependency is currently loaded as follows:
function tryLoadLZ4Module(): LZ4Module | undefined {
try {
return require('lz4'); // eslint-disable-line global-require
} catch (err) {
const isModuleNotFoundError = err instanceof Error && 'code' in err && err.code === 'MODULE_NOT_FOUND';
if (!isModuleNotFoundError) {
throw err;
}
}
}However, this fails when running under Jest due to jestjs/jest#2549 (see also jestjs/jest#11808). Namely, the err instanceof Error check returns false since Jest substitutes its own objects for JS globals. This causes calling code to fail with a ModuleNotFound error.
Is the err instanecof Error check really needed here? Can it be removed?
karthikeayan, eranga-acerta, vadimgaidai, IrakliJani and priithaamer
Metadata
Metadata
Assignees
Labels
No labels