Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"program": function(require, exports, module) {
var test = require('test');
test.assert(require.main != null && require.main === module, 'main module has require.main');
var aMain = require('a').main();
test.assert(aMain != null && aMain === module, 'submodule has require.main');
require.ensure(['b'], function(require) {
test.assert(require.main != null && require.main === module, 'require.ensure has require.main');
test.print('DONE', 'info');
});
}}, ["test", "a"]);
var pass = false;
var test = require('test');
try {
require('a');
} catch (exception) {
pass = true;
}
test.assert(pass, 'require does not fall back to relative modules when absolutes are not available.')
var pass = false;
var test = require("test");
try {
require("a");
} catch (exception) {
pass = true;
}
test.assert(pass, "require does not fall back to relative modules when absolutes are not available.");
"submodule/a": function(require, exports, module) {
var test = require('test');
var pass = false;
var test = require('test');
try {
require('a');
} catch (exception) {
pass = true;
}
test.assert(pass, 'require does not fall back to relative modules when absolutes are not available.')
}}, ["test", "a"]);
var test = require('test');
foo = function () {};
test.assert(typeof foo != "undefined" && exports.foo == foo, 'free assignment bound to exports');
var a = require('a');
test.assert(a.aVeryUnlikelyIdentifier, 'free assignment exported from other module');
test.assert(typeof aVeryUnlikelyIdentifier == "undefined", 'free assignment not implicitly communicated with common scope');
test.print('DONE', 'info');