Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinícius do Carmo <vinicius.m.do.carmo@gmail.com>2017-01-23 20:39:40 +0300
committerMyles Borins <myles.borins@gmail.com>2017-03-09 04:11:19 +0300
commit62f6749cd6fcce499000d529df78fc5a69687926 (patch)
treefbccb06d1085b111559b7f96b76042c0d8e14866
parent5cea2239d8d671d1269d7ab911f80f2e31b062f2 (diff)
test: expand test coverage of fs.js
* test reading a file passing a not valid enconding Refs: https://coverage.nodejs.org/coverage-067be658f966dafe/root/internal/fs.js.html PR-URL: https://github.com/nodejs/node/pull/10947 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
-rw-r--r--test/parallel/test-fs-read-file-assert-encoding.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/parallel/test-fs-read-file-assert-encoding.js b/test/parallel/test-fs-read-file-assert-encoding.js
new file mode 100644
index 00000000000..897bcd3bc98
--- /dev/null
+++ b/test/parallel/test-fs-read-file-assert-encoding.js
@@ -0,0 +1,13 @@
+'use strict';
+require('../common');
+
+const assert = require('assert');
+const fs = require('fs');
+
+const encoding = 'foo-8';
+const filename = 'bar.txt';
+
+assert.throws(
+ fs.readFile.bind(fs, filename, { encoding }, () => {}),
+ new RegExp(`Error: Unknown encoding: ${encoding}$`)
+);