Files
meteor/tools/tests/apps/shell/server/main.js
Jesse Rosenberger ba118085dc Test which ensures that the global _ isn't compromised.
As demonstrated in https://github.com/meteor/meteor/issues/9276.

This test wouldn't have caught the regression in the previous solution
since the lack of a TTY in the `self-test` test harness caused the tests
themselves to take the path through `shell-server`'s `evaluateAndExit`
logic, which didn't use the `global` scope in the same way as the
interactive shell.  That is no longer the case as of e0682c553d.
2017-11-30 19:15:25 +02:00

17 lines
520 B
JavaScript

import { Meteor } from 'meteor/meteor';
Meteor.startup(() => {
Meteor.checkMeFromShell = "oky dok";
});
// Create a global underscore variable which should be preserved,
// 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 };
Meteor.methods({
"__meteor__/__self_test__/shell-tests/underscore"() {
return typeof _ === "object" && Object.keys(_);
}
})