summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2019-07-05 14:15:19 -0700
committerMichaƫl Zasso <targos@protonmail.com>2019-07-20 11:05:25 +0200
commitb4643dd9dcf6c01eed446a83354674a8786d009d (patch)
treefc8084d877da2711c67cf04e487db4b56a56b04e /test
parentb1db810d501079f767579a241c3f613e8a204294 (diff)
downloadandroid-node-v8-b4643dd9dcf6c01eed446a83354674a8786d009d.tar.gz
android-node-v8-b4643dd9dcf6c01eed446a83354674a8786d009d.tar.bz2
android-node-v8-b4643dd9dcf6c01eed446a83354674a8786d009d.zip
test: add test-fs-writeFileSync-invalid-windows
Add a known_issues test for the Windows returning ENOTFOUND where EINVAL is more appropriate. This happens with various functions in the `fs` module when an invalid path is used. Refs: https://github.com/nodejs/node/issues/8987 PR-URL: https://github.com/nodejs/node/pull/28569 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test')
-rw-r--r--test/known_issues/test-fs-writeFileSync-invalid-windows.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/known_issues/test-fs-writeFileSync-invalid-windows.js b/test/known_issues/test-fs-writeFileSync-invalid-windows.js
new file mode 100644
index 0000000000..614b7427c0
--- /dev/null
+++ b/test/known_issues/test-fs-writeFileSync-invalid-windows.js
@@ -0,0 +1,21 @@
+'use strict';
+
+const common = require('../common');
+
+// Test that using an invalid file name with writeFileSync() on Windows returns
+// EINVAL. With libuv 1.x, it returns ENOTFOUND. This should be fixed when we
+// update to libuv 2.x.
+//
+// Refs: https://github.com/nodejs/node/issues/8987
+
+const assert = require('assert');
+const fs = require('fs');
+
+if (!common.isWindows) {
+ // Change to `common.skip()` when the test is moved out of `known_issues`.
+ assert.fail('Windows-only test');
+}
+
+assert.throws(() => {
+ fs.writeFileSync('fhqwhgads??', 'come on');
+}, { code: 'EINVAL' });