Skip to content

Commit a64af39

Browse files
TrottMyles Borins
authored and
Myles Borins
committed
test: remove duplicate required module
`common` is required twice in test-setproctitle.js. Remove one of the instances. Other refactoring: * var -> const and let * assert.equal -> assert.strictEqual * assert.notEqual -> assert.notStrickEqual * string concatenation -> template string * use of assert.ifError() instead of asserting error is null PR-URL: #9169 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent a038fcc commit a64af39

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/parallel/test-setproctitle.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ if ('linux freebsd darwin'.indexOf(process.platform) === -1) {
88
return;
99
}
1010

11-
var assert = require('assert');
12-
var exec = require('child_process').exec;
13-
var path = require('path');
11+
const assert = require('assert');
12+
const exec = require('child_process').exec;
13+
const path = require('path');
1414

1515
// The title shouldn't be too long; libuv's uv_set_process_title() out of
1616
// security considerations no longer overwrites envp, only argv, so the
1717
// maximum title length is possibly quite short.
18-
var title = 'testme';
18+
let title = 'testme';
1919

20-
assert.notEqual(process.title, title);
20+
assert.notStrictEqual(process.title, title);
2121
process.title = title;
22-
assert.equal(process.title, title);
22+
assert.strictEqual(process.title, title);
2323

24-
exec('ps -p ' + process.pid + ' -o args=', function(error, stdout, stderr) {
25-
assert.equal(error, null);
26-
assert.equal(stderr, '');
24+
exec(`ps -p ${process.pid} -o args=`, function callback(error, stdout, stderr) {
25+
assert.ifError(error);
26+
assert.strictEqual(stderr, '');
2727

2828
// freebsd always add ' (procname)' to the process title
2929
if (process.platform === 'freebsd')
3030
title += ` (${path.basename(process.execPath)})`;
3131

3232
// omitting trailing whitespace and \n
33-
assert.equal(stdout.replace(/\s+$/, ''), title);
33+
assert.strictEqual(stdout.replace(/\s+$/, ''), title);
3434
});

0 commit comments

Comments
 (0)