aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-mkdtemp-prefix-check.js
diff options
context:
space:
mode:
authormatzavinos <matzavinos@workable.com>2017-08-26 07:46:47 -0400
committerRefael Ackermann <refack@gmail.com>2017-08-31 19:37:39 -0400
commit219932a9f77f8a013d50067e931e6c877f9024d3 (patch)
tree5ba624e5212f22e280ca3cab59d6f09277f54814 /test/parallel/test-fs-mkdtemp-prefix-check.js
parenta517466aa7dcb7afe4864ab12d0f97e10a8d4ee0 (diff)
downloadandroid-node-v8-219932a9f77f8a013d50067e931e6c877f9024d3.tar.gz
android-node-v8-219932a9f77f8a013d50067e931e6c877f9024d3.tar.bz2
android-node-v8-219932a9f77f8a013d50067e931e6c877f9024d3.zip
errors: convert 'fs'
covert lib/fs.js over to using lib/internal/errors.js i have not addressed the cases that use errnoException(), for reasons described in GH-12926 - throw the ERR_INVALID_CALLBACK error when the the callback is invalid - replace the ['object', 'string'] with ['string', 'object'] in the error constructor call, to better match the previous err msg in the getOptions() function - add error ERR_VALUE_OUT_OF_RANGE in lib/internal/errors.js, this error is thrown when a numeric value is out of range - document the ERR_VALUE_OUT_OF_RANGE err in errors.md - correct the expected args, in the error thrown in the function fs._toUnixTimestamp() to ['Date', 'time in seconds'] (lib/fs.js) - update the listener error type in the fs.watchFile() function, from Error to TypeError (lib/fs.js) - update errors from ERR_INVALID_OPT_VALUE to ERR_INVALID_ARG_TYPE in the functions fs.ReadStream() and fs.WriteStream(), for the cases of range errors use the new error: ERR_VALUE_OUT_OF_RANGE (lib/fs.js) PR-URL: https://github.com/nodejs/node/pull/15043 Refs: https://github.com/nodejs/node/issues/11273 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'test/parallel/test-fs-mkdtemp-prefix-check.js')
-rw-r--r--test/parallel/test-fs-mkdtemp-prefix-check.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/test/parallel/test-fs-mkdtemp-prefix-check.js b/test/parallel/test-fs-mkdtemp-prefix-check.js
index 786d0fe7ba..4573dbbaae 100644
--- a/test/parallel/test-fs-mkdtemp-prefix-check.js
+++ b/test/parallel/test-fs-mkdtemp-prefix-check.js
@@ -1,22 +1,29 @@
'use strict';
const common = require('../common');
-const assert = require('assert');
const fs = require('fs');
-const expectedError = /^TypeError: filename prefix is required$/;
const prefixValues = [undefined, null, 0, true, false, 1, ''];
function fail(value) {
- assert.throws(
- () => fs.mkdtempSync(value, {}),
- expectedError
- );
+ common.expectsError(
+ () => {
+ fs.mkdtempSync(value, {});
+ },
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError
+ });
}
function failAsync(value) {
- assert.throws(
- () => fs.mkdtemp(value, common.mustNotCall()), expectedError
- );
+ common.expectsError(
+ () => {
+ fs.mkdtemp(value, common.mustNotCall());
+ },
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError
+ });
}
prefixValues.forEach((prefixValue) => {