- fix test: "meteor shell"

This commit is contained in:
denihs
2023-04-20 09:39:01 -04:00
parent ac0adaf5e9
commit 1347216efe
2 changed files with 20 additions and 2 deletions

View File

@@ -249,7 +249,25 @@ class Server {
}
evalCommandPromise
.then(() => defaultEval(code, context, file, callback))
.then(() => defaultEval(code, context, file, (error, result) => {
if (error) {
callback(error);
} else {
// Check if the result is a Promise
if (result && typeof result.then === 'function') {
// Handle the Promise resolution and rejection
result
.then(resolvedResult => {
callback(null, resolvedResult);
})
.catch(rejectedError => {
callback(rejectedError);
});
} else {
callback(null, result);
}
}
}))
.catch(callback);
}

View File

@@ -8,7 +8,7 @@ Meteor.startup(() => {
// not overriden by the special REPL `_` variable, when a command
// is executed on the shell. The method will allow the test to call
// back and confirm it's still set.
_ = {_specialUnderscoreTestObject: true };
global._ = {_specialUnderscoreTestObject: true };
Meteor.methods({
"__meteor__/__self_test__/shell-tests/underscore"() {
return typeof _ === "object" && Object.keys(_);