-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fs: remove
fs.F_OK
, fs.R_OK
, fs.W_OK
, fs.X_OK
- Loading branch information
1 parent
b02cd41
commit 7aa2d97
Showing
4 changed files
with
11 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,8 @@ | ||
'use strict'; | ||
const { expectWarning } = require('../common'); | ||
require('../common'); | ||
const fs = require('fs'); | ||
const assert = require('assert'); | ||
|
||
// Check if the two constants accepted by chmod() on Windows are defined. | ||
assert.notStrictEqual(fs.constants.S_IRUSR, undefined); | ||
assert.notStrictEqual(fs.constants.S_IWUSR, undefined); | ||
|
||
// Check for runtime deprecation warning, there should be no setter | ||
const { F_OK, R_OK, W_OK, X_OK } = fs.constants; | ||
|
||
assert.throws(() => { fs.F_OK = 'overwritten'; }, { name: 'TypeError' }); | ||
assert.throws(() => { fs.R_OK = 'overwritten'; }, { name: 'TypeError' }); | ||
assert.throws(() => { fs.W_OK = 'overwritten'; }, { name: 'TypeError' }); | ||
assert.throws(() => { fs.X_OK = 'overwritten'; }, { name: 'TypeError' }); | ||
|
||
expectWarning( | ||
'DeprecationWarning', | ||
'fs.F_OK is deprecated, use fs.constants.F_OK instead', | ||
'DEP0176' | ||
); | ||
|
||
assert.strictEqual(fs.F_OK, F_OK); | ||
assert.strictEqual(fs.R_OK, R_OK); | ||
assert.strictEqual(fs.W_OK, W_OK); | ||
assert.strictEqual(fs.X_OK, X_OK); |