summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2019-07-05 14:15:19 -0700
committerRich Trott <rtrott@gmail.com>2019-07-11 10:27:42 -0700
commitb6e301a9e0ccdebda1ff558e9aa6cf4497412860 (patch)
tree8a47d5ed85caa0af6fbfb726829a24d1682d2bb3
parent5ebaf703aa24abd7f45875d61d72a5088a0eb78b (diff)
downloadandroid-node-v8-b6e301a9e0ccdebda1ff558e9aa6cf4497412860.tar.gz
android-node-v8-b6e301a9e0ccdebda1ff558e9aa6cf4497412860.tar.bz2
android-node-v8-b6e301a9e0ccdebda1ff558e9aa6cf4497412860.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>
-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' });