mirror of https://github.com/nodejs/node.git
module: correct the order of the assertions
this puts the type-checking assertions in require into proper order. PR-URL: https://github.com/joyent/node/pull/8333 Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-by: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
parent
855b1c98ca
commit
00d7b13a18
|
@ -360,8 +360,8 @@ Module.prototype.load = function(filename) {
|
|||
// Loads a module at the given file path. Returns that module's
|
||||
// `exports` property.
|
||||
Module.prototype.require = function(path) {
|
||||
assert(util.isString(path), 'path must be a string');
|
||||
assert(path, 'missing path');
|
||||
assert(util.isString(path), 'path must be a string');
|
||||
return Module._load(path, this);
|
||||
};
|
||||
|
||||
|
|
|
@ -42,3 +42,15 @@ try {
|
|||
} catch (e) {
|
||||
assert.notEqual(e.toString().indexOf(dlerror_msg), -1);
|
||||
}
|
||||
|
||||
try {
|
||||
require();
|
||||
} catch (e) {
|
||||
assert.notEqual(e.toString().indexOf('missing path'), -1);
|
||||
}
|
||||
|
||||
try {
|
||||
require({});
|
||||
} catch (e) {
|
||||
assert.notEqual(e.toString().indexOf('path must be a string'), -1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue