Skip to content

Commit 5c42d98

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 7b75cb9 commit 5c42d98

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

test/parallel/test-setproctitle.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,33 @@
22
// Original test written by Jakub Lekstan <[email protected]>
33
const common = require('../common');
44

5-
require('../common');
65
// FIXME add sunos support
76
if (!(common.isFreeBSD || common.isOSX || common.isLinux)) {
87
console.log(`1..0 # Skipped: Unsupported platform [${process.platform}]`);
98
return;
109
}
1110

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

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

21-
assert.notEqual(process.title, title);
20+
assert.notStrictEqual(process.title, title);
2221
process.title = title;
23-
assert.equal(process.title, title);
22+
assert.strictEqual(process.title, title);
2423

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

2928
// freebsd always add ' (procname)' to the process title
3029
if (common.isFreeBSD)
3130
title += ` (${path.basename(process.execPath)})`;
3231

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

0 commit comments

Comments
 (0)