Skip to content

Commit 644d990

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 168f73c commit 644d990

File tree

2 files changed

+8
-34
lines changed

2 files changed

+8
-34
lines changed

test/fixtures/a1.js

-25
This file was deleted.

test/parallel/test-fs-chmod.js

+8-9
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,17 @@ if (common.isWindows) {
5050
mode_sync = 0o644;
5151
}
5252

53-
const file1 = path.join(common.fixturesDir, 'a.js');
54-
const file2 = path.join(common.fixturesDir, 'a1.js');
53+
common.refreshTmpDir();
54+
55+
const file1 = path.join(common.tmpDir, 'a.js');
56+
const file2 = path.join(common.tmpDir, 'a1.js');
57+
58+
// Create file1.
59+
fs.closeSync(fs.openSync(file1, 'w'));
5560

5661
fs.chmod(file1, mode_async.toString(8), common.mustCall((err) => {
5762
assert.ifError(err);
5863

59-
console.log(fs.statSync(file1).mode);
60-
6164
if (common.isWindows) {
6265
assert.ok((fs.statSync(file1).mode & 0o777) & mode_async);
6366
} else {
@@ -72,14 +75,12 @@ fs.chmod(file1, mode_async.toString(8), common.mustCall((err) => {
7275
}
7376
}));
7477

75-
fs.open(file2, 'a', common.mustCall((err, fd) => {
78+
fs.open(file2, 'w', common.mustCall((err, fd) => {
7679
assert.ifError(err);
7780

7881
fs.fchmod(fd, mode_async.toString(8), common.mustCall((err) => {
7982
assert.ifError(err);
8083

81-
console.log(fs.fstatSync(fd).mode);
82-
8384
if (common.isWindows) {
8485
assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_async);
8586
} else {
@@ -101,13 +102,11 @@ fs.open(file2, 'a', common.mustCall((err, fd) => {
101102
if (fs.lchmod) {
102103
const link = path.join(common.tmpDir, 'symbolic-link');
103104

104-
common.refreshTmpDir();
105105
fs.symlinkSync(file2, link);
106106

107107
fs.lchmod(link, mode_async, common.mustCall((err) => {
108108
assert.ifError(err);
109109

110-
console.log(fs.lstatSync(link).mode);
111110
assert.strictEqual(mode_async, fs.lstatSync(link).mode & 0o777);
112111

113112
fs.lchmodSync(link, mode_sync);

0 commit comments

Comments
 (0)