UEA-PRODEM

This commit is contained in:
2026-06-10 12:14:46 -03:00
parent f54126b9d8
commit 9947565694
5319 changed files with 148520 additions and 129332 deletions
+23 -3
View File
@@ -140,7 +140,7 @@ test('symlinked', function (t) {
});
test('readPackageSync', function (t) {
t.plan(3);
t.plan(4);
var files = {};
files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep';
@@ -179,12 +179,12 @@ test('readPackageSync', function (t) {
);
});
var readPackageSync = function (readFileSync, file) {
function readPackageSync(readFileSync, file) {
if (file.indexOf(path.join('bar', 'package.json')) >= 0) {
return { main: './something-else.js' };
}
return JSON.parse(files[path.resolve(file)]);
};
}
t.test('with readPackage', function (st) {
st.plan(1);
@@ -210,5 +210,25 @@ test('readPackageSync', function (t) {
'errors when both readFile and readPackage are provided'
);
});
t.test('readPackageSync error propagates correctly', function (st) {
st.plan(1);
var readPackageError = new Error('read package error');
function failReadPackageSync() {
throw readPackageError;
}
var options = opts('/foo');
delete options.readFileSync;
options.readPackageSync = failReadPackageSync;
st.throws(
function () { resolve.sync('bar', options); },
readPackageError,
'readPackageSync error is thrown'
);
});
});