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>
This commit is contained in:
parent
5ebaf703aa
commit
b6e301a9e0
21
test/known_issues/test-fs-writeFileSync-invalid-windows.js
Normal file
21
test/known_issues/test-fs-writeFileSync-invalid-windows.js
Normal file
@ -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' });
|
Loading…
x
Reference in New Issue
Block a user