mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
- fix test: "meteor shell"
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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(_);
|
||||
|
||||
Reference in New Issue
Block a user