Skip to content

Commit

Permalink
test: add test-fs-writeFileSync-invalid-windows
Browse files Browse the repository at this point in the history
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 <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
Trott authored and targos committed Jul 20, 2019
1 parent b1db810 commit b4643dd
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/known_issues/test-fs-writeFileSync-invalid-windows.js
Original file line number Diff line number Diff line change
@@ -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' });

0 comments on commit b4643dd

Please sign in to comment.