Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1499,8 +1499,7 @@ static void Chdir(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);

if (args.Length() != 1 || !args[0]->IsString()) {
// FIXME(bnoordhuis) ThrowTypeError?
return env->ThrowError("Bad argument.");
return env->ThrowTypeError("Bad argument.");
}

node::Utf8Value path(args.GetIsolate(), args[0]);
Expand Down
5 changes: 5 additions & 0 deletions test/sequential/test-chdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ assert(process.cwd() == dir);
process.chdir('..');
assert(process.cwd() == path.resolve(common.fixturesDir));
fs.rmdirSync(dir);

assert.throws(function() { process.chdir({}); }, TypeError, 'Bad argument.');
assert.throws(function() { process.chdir(); }, TypeError, 'Bad argument.');
assert.throws(function() { process.chdir("x", "y"); }, TypeError, 'Bad argument.');