test: improve test-process-chdir

remove typeError constructor and replace with regex string
to match typeError message

PR-URL: https://github.com/nodejs/node/pull/12589
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Cai <davidcai1993@yahoo.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
This commit is contained in:
vperezma 2017-04-22 11:15:18 -07:00 committed by James M Snell
parent 0105e6f826
commit b968d584af

View File

@ -30,7 +30,9 @@ process.chdir('..');
assert.strictEqual(process.cwd().normalize(),
path.resolve(common.tmpDir).normalize());
assert.throws(function() { process.chdir({}); }, TypeError, 'Bad argument.');
assert.throws(function() { process.chdir(); }, TypeError, 'Bad argument.');
assert.throws(function() { process.chdir({}); },
/^TypeError: Bad argument\.$/, 'Bad argument.');
assert.throws(function() { process.chdir(); },
/^TypeError: Bad argument\.$/, 'Bad argument.');
assert.throws(function() { process.chdir('x', 'y'); },
TypeError, 'Bad argument.');
/^TypeError: Bad argument\.$/, 'Bad argument.');