summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-make-callback.js
diff options
context:
space:
mode:
authorMyles Borins <mylesborins@google.com>2017-05-11 18:52:20 +0300
committerMyles Borins <mylesborins@google.com>2017-05-20 10:21:34 -0400
commit8250bfd1e5188d5dada58aedf7a991e959d5eaa9 (patch)
tree3fd01220deeb17bb66f490bc4be2463ef1cfe8d2 /test/parallel/test-fs-make-callback.js
parentc60a7fa7383a983a0348e8876fdd84b04c353436 (diff)
downloadnode-new-8250bfd1e5188d5dada58aedf7a991e959d5eaa9.tar.gz
fs: Revert throw on invalid callbacks
This reverts 4cb5f3daa350421e4eb4622dc818633d3a0659b3 Based on community feedback I think we should consider reverting this change. We should explore how this could be solved via linting rules. Refs: https://github.com/nodejs/node/pull/12562 PR-URL: https://github.com/nodejs/node/pull/12976 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-make-callback.js')
-rw-r--r--test/parallel/test-fs-make-callback.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/parallel/test-fs-make-callback.js b/test/parallel/test-fs-make-callback.js
index aed5811fc7..8a19e1cc96 100644
--- a/test/parallel/test-fs-make-callback.js
+++ b/test/parallel/test-fs-make-callback.js
@@ -2,10 +2,11 @@
const common = require('../common');
const assert = require('assert');
const fs = require('fs');
-const cbTypeError = common.expectsError({code: 'ERR_INVALID_CALLBACK'});
+const cbTypeError = /^TypeError: "callback" argument must be a function$/;
const callbackThrowValues = [null, true, false, 0, 1, 'foo', /foo/, [], {}];
const { sep } = require('path');
+const warn = 'Calling an asynchronous function without callback is deprecated.';
common.refreshTmpDir();
@@ -16,6 +17,11 @@ function testMakeCallback(cb) {
};
}
+common.expectWarning('DeprecationWarning', warn);
+
+// Passing undefined/nothing calls rethrow() internally, which emits a warning
+assert.doesNotThrow(testMakeCallback());
+
function invalidCallbackThrowsTests() {
callbackThrowValues.forEach((value) => {
assert.throws(testMakeCallback(value), cbTypeError);