summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-access.js
diff options
context:
space:
mode:
authorSakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com>2017-04-21 10:16:15 +0530
committerSakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com>2017-05-10 00:04:01 +0530
commit4cb5f3daa350421e4eb4622dc818633d3a0659b3 (patch)
tree490ce4076130828921ddb6a7bfd45e49039d17de /test/parallel/test-fs-access.js
parente429f9a42af94f039621a1bf9f21ad424aa00558 (diff)
downloadandroid-node-v8-4cb5f3daa350421e4eb4622dc818633d3a0659b3.tar.gz
android-node-v8-4cb5f3daa350421e4eb4622dc818633d3a0659b3.tar.bz2
android-node-v8-4cb5f3daa350421e4eb4622dc818633d3a0659b3.zip
fs: throw on invalid callbacks for async functions
If an asynchronous function is passed no callback function, there is no way to return the result. This patch throws an error if the callback passed is not valid or none passed at all. PR-URL: https://github.com/nodejs/node/pull/12562 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test/parallel/test-fs-access.js')
-rw-r--r--test/parallel/test-fs-access.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/parallel/test-fs-access.js b/test/parallel/test-fs-access.js
index f378824cbc..9ea29c7141 100644
--- a/test/parallel/test-fs-access.js
+++ b/test/parallel/test-fs-access.js
@@ -87,11 +87,11 @@ assert.throws(() => {
assert.throws(() => {
fs.access(__filename, fs.F_OK);
-}, /^TypeError: "callback" argument must be a function$/);
+}, common.expectsError({code: 'ERR_INVALID_CALLBACK'}));
assert.throws(() => {
fs.access(__filename, fs.F_OK, {});
-}, /^TypeError: "callback" argument must be a function$/);
+}, common.expectsError({code: 'ERR_INVALID_CALLBACK'}));
assert.doesNotThrow(() => {
fs.accessSync(__filename);