Skip to content

Commit ae27cb8

Browse files
TrottMylesBorins
authored andcommitted
test: do not modify fixtures in test-fs-chmod
`test-fs-chmod` modifies the permissions on files in `test/fixtures`. This change has the test use the temp directory instead. One of the fixture files is not used by any other test, so it has been deleted. I took this opportunity to remove `console.log()` statements from the test. PR-URL: #14926 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent eb46609 commit ae27cb8

File tree

2 files changed

+8
-55
lines changed

2 files changed

+8
-55
lines changed

test/fixtures/a1.js

-46
This file was deleted.

test/parallel/test-fs-chmod.js

+8-9
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,17 @@ if (common.isWindows) {
7171
mode_sync = 0o644;
7272
}
7373

74-
const file1 = path.join(common.fixturesDir, 'a.js');
75-
const file2 = path.join(common.fixturesDir, 'a1.js');
74+
common.refreshTmpDir();
75+
76+
const file1 = path.join(common.tmpDir, 'a.js');
77+
const file2 = path.join(common.tmpDir, 'a1.js');
78+
79+
// Create file1.
80+
fs.closeSync(fs.openSync(file1, 'w'));
7681

7782
fs.chmod(file1, mode_async.toString(8), common.mustCall((err) => {
7883
assert.ifError(err);
7984

80-
console.log(fs.statSync(file1).mode);
81-
8285
if (common.isWindows) {
8386
assert.ok((fs.statSync(file1).mode & 0o777) & mode_async);
8487
} else {
@@ -93,14 +96,12 @@ fs.chmod(file1, mode_async.toString(8), common.mustCall((err) => {
9396
}
9497
}));
9598

96-
fs.open(file2, 'a', common.mustCall((err, fd) => {
99+
fs.open(file2, 'w', common.mustCall((err, fd) => {
97100
assert.ifError(err);
98101

99102
fs.fchmod(fd, mode_async.toString(8), common.mustCall((err) => {
100103
assert.ifError(err);
101104

102-
console.log(fs.fstatSync(fd).mode);
103-
104105
if (common.isWindows) {
105106
assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_async);
106107
} else {
@@ -122,13 +123,11 @@ fs.open(file2, 'a', common.mustCall((err, fd) => {
122123
if (fs.lchmod) {
123124
const link = path.join(common.tmpDir, 'symbolic-link');
124125

125-
common.refreshTmpDir();
126126
fs.symlinkSync(file2, link);
127127

128128
fs.lchmod(link, mode_async, common.mustCall((err) => {
129129
assert.ifError(err);
130130

131-
console.log(fs.lstatSync(link).mode);
132131
assert.strictEqual(mode_async, fs.lstatSync(link).mode & 0o777);
133132

134133
fs.lchmodSync(link, mode_sync);

0 commit comments

Comments
 (0)