Skip to content

Commit b4643dd

Browse files
Trotttargos
authored andcommitted
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: #8987 PR-URL: #28569 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent b1db810 commit b4643dd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
5+
// Test that using an invalid file name with writeFileSync() on Windows returns
6+
// EINVAL. With libuv 1.x, it returns ENOTFOUND. This should be fixed when we
7+
// update to libuv 2.x.
8+
//
9+
// Refs: https://github.com/nodejs/node/issues/8987
10+
11+
const assert = require('assert');
12+
const fs = require('fs');
13+
14+
if (!common.isWindows) {
15+
// Change to `common.skip()` when the test is moved out of `known_issues`.
16+
assert.fail('Windows-only test');
17+
}
18+
19+
assert.throws(() => {
20+
fs.writeFileSync('fhqwhgads??', 'come on');
21+
}, { code: 'EINVAL' });

0 commit comments

Comments
 (0)