Skip to content

Commit fa83454

Browse files
committed
Use template strings and const instead of var
See comments to PR #3929
1 parent 7c76592 commit fa83454

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

test/parallel/test-fs-long-path.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
'use strict';
2-
var common = require('../common');
3-
var fs = require('fs');
4-
var path = require('path');
5-
var assert = require('assert');
6-
var os = require('os');
2+
const common = require('../common');
3+
const fs = require('fs');
4+
const path = require('path');
5+
const os = require('os');
76

87
// when it fails test again under real OS tmp dir on Linux when it is
98
// readable/writable to avoid failing tests on ecryptfs filesystems:
109
// https://github.com/nodejs/node/issues/2255
1110
// it follows advice in comments to:
1211
// https://github.com/nodejs/node/pull/3925
12+
// https://github.com/nodejs/node/pull/3929
1313
try {
1414
common.refreshTmpDir();
1515
testFsLongPath(common.tmpDir);
1616
common.refreshTmpDir();
1717
} catch (e) {
1818
if (os.type() == 'Linux') {
1919
fs.accessSync(os.tmpdir(), fs.R_OK | fs.W_OK);
20-
var tmpDir = path.join(os.tmpdir(),
21-
'node-' + process.version + '-test-' + (Math.random() * 1e6 | 0));
20+
const tmpDir = path.join(os.tmpdir(),
21+
`node-${process.version}-test-${1e6 * Math.random() | 0}`);
2222
fs.mkdirSync(tmpDir);
2323
testFsLongPath(tmpDir);
2424
fs.rmdirSync(tmpDir);
@@ -30,9 +30,9 @@ try {
3030
function testFsLongPath(tmpDir) {
3131

3232
// make a path that will be at least 260 chars long.
33-
var fileNameLen = Math.max(260 - tmpDir.length - 1, 1);
34-
var fileName = path.join(tmpDir, new Array(fileNameLen + 1).join('x'));
35-
var fullPath = path.resolve(fileName);
33+
const fileNameLen = Math.max(260 - tmpDir.length - 1, 1);
34+
const fileName = path.join(tmpDir, new Array(fileNameLen + 1).join('x'));
35+
const fullPath = path.resolve(fileName);
3636

3737
console.log({
3838
filenameLength: fileName.length,

test/parallel/test-require-long-path.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@ const os = require('os');
77
// when it fails test again under real OS tmp dir on Linux when it is
88
// readable/writable to avoid failing tests on ecryptfs filesystems:
99
// https://github.com/nodejs/node/issues/2255
10-
// it takes into account comments in:
10+
// it follows advice in comments to:
1111
// https://github.com/nodejs/node/pull/3925
12+
// https://github.com/nodejs/node/pull/3929
1213
try {
1314
common.refreshTmpDir();
1415
testRequireLongPath(common.tmpDir);
1516
common.refreshTmpDir();
1617
} catch (e) {
1718
if (os.type() == 'Linux') {
1819
fs.accessSync(os.tmpdir(), fs.R_OK | fs.W_OK);
19-
var tmpDir = path.join(os.tmpdir(),
20-
'node-' + process.version + '-test-' + (Math.random() * 1e6 | 0));
20+
const tmpDir = path.join(os.tmpdir(),
21+
`node-${process.version}-test-${1e6 * Math.random() | 0}`);
2122
fs.mkdirSync(tmpDir);
2223
testRequireLongPath(tmpDir);
2324
fs.rmdirSync(tmpDir);

0 commit comments

Comments
 (0)