summaryrefslogtreecommitdiff
path: root/test/parallel/test-process-chdir.js
diff options
context:
space:
mode:
authorMichaƫl Zasso <targos@protonmail.com>2018-04-12 11:54:19 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2018-04-26 19:42:55 +0200
commit2fd248f639981c72794efef397dfae5263ebdff5 (patch)
tree1197085154c2f2d1565ffa89099db66f7fc29833 /test/parallel/test-process-chdir.js
parente8361287030fbaa773761bb3798d45903bb160f6 (diff)
downloadandroid-node-v8-2fd248f639981c72794efef397dfae5263ebdff5.tar.gz
android-node-v8-2fd248f639981c72794efef397dfae5263ebdff5.tar.bz2
android-node-v8-2fd248f639981c72794efef397dfae5263ebdff5.zip
process: migrate methods to throw errors with code
Migrate some methods from node.cc to JS in order to properly throw errors with codes. PR-URL: https://github.com/nodejs/node/pull/19973 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-process-chdir.js')
-rw-r--r--test/parallel/test-process-chdir.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/test/parallel/test-process-chdir.js b/test/parallel/test-process-chdir.js
index c0a245ffd3..998147dd43 100644
--- a/test/parallel/test-process-chdir.js
+++ b/test/parallel/test-process-chdir.js
@@ -1,6 +1,6 @@
'use strict';
-require('../common');
+const common = require('../common');
const assert = require('assert');
const fs = require('fs');
const path = require('path');
@@ -33,10 +33,9 @@ process.chdir('..');
assert.strictEqual(process.cwd().normalize(),
path.resolve(tmpdir.path).normalize());
-const errMessage = /^TypeError: Bad argument\.$/;
-assert.throws(function() { process.chdir({}); },
- errMessage, 'Bad argument.');
-assert.throws(function() { process.chdir(); },
- errMessage, 'Bad argument.');
-assert.throws(function() { process.chdir('x', 'y'); },
- errMessage, 'Bad argument.');
+const err = {
+ code: 'ERR_INVALID_ARG_TYPE',
+ message: /The "directory" argument must be of type string/
+};
+common.expectsError(function() { process.chdir({}); }, err);
+common.expectsError(function() { process.chdir(); }, err);