Skip to content

Commit 5b29e5a

Browse files
atsui-tcMylesBorins
authored andcommitted
test: modify test messages to template literals
PR-URL: #15931 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 7df8e0b commit 5b29e5a

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

test/parallel/test-cli-syntax.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ const notFoundRE = /^Error: Cannot find module/m;
3333
const cmd = [node, ..._args].join(' ');
3434
exec(cmd, common.mustCall((err, stdout, stderr) => {
3535
assert.ifError(err);
36-
assert.strictEqual(stdout, '', 'stdout produced');
37-
assert.strictEqual(stderr, '', 'stderr produced');
36+
assert.strictEqual(stdout, '');
37+
assert.strictEqual(stderr, '');
3838
}));
3939
});
4040
});
@@ -54,16 +54,16 @@ const notFoundRE = /^Error: Cannot find module/m;
5454
const cmd = [node, ..._args].join(' ');
5555
exec(cmd, common.mustCall((err, stdout, stderr) => {
5656
assert.strictEqual(err instanceof Error, true);
57-
assert.strictEqual(err.code, 1, `code === ${err.code}`);
57+
assert.strictEqual(err.code, 1);
5858

5959
// no stdout should be produced
60-
assert.strictEqual(stdout, '', 'stdout produced');
60+
assert.strictEqual(stdout, '');
6161

6262
// stderr should have a syntax error message
63-
assert(syntaxErrorRE.test(stderr), 'stderr incorrect');
63+
assert(syntaxErrorRE.test(stderr), `${syntaxErrorRE} === ${stderr}`);
6464

6565
// stderr should include the filename
66-
assert(stderr.startsWith(file), "stderr doesn't start with the filename");
66+
assert(stderr.startsWith(file), `${stderr} starts with ${file}`);
6767
}));
6868
});
6969
});
@@ -81,12 +81,12 @@ const notFoundRE = /^Error: Cannot find module/m;
8181
const cmd = [node, ..._args].join(' ');
8282
exec(cmd, common.mustCall((err, stdout, stderr) => {
8383
// no stdout should be produced
84-
assert.strictEqual(stdout, '', 'stdout produced');
84+
assert.strictEqual(stdout, '');
8585

8686
// stderr should have a module not found error message
87-
assert(notFoundRE.test(stderr), 'stderr incorrect');
87+
assert(notFoundRE.test(stderr), `${notFoundRE} === ${stderr}`);
8888

89-
assert.strictEqual(err.code, 1, `code === ${err.code}`);
89+
assert.strictEqual(err.code, 1);
9090
}));
9191
});
9292
});
@@ -98,10 +98,10 @@ syntaxArgs.forEach(function(args) {
9898
const c = spawnSync(node, args, { encoding: 'utf8', input: stdin });
9999

100100
// no stdout or stderr should be produced
101-
assert.strictEqual(c.stdout, '', 'stdout produced');
102-
assert.strictEqual(c.stderr, '', 'stderr produced');
101+
assert.strictEqual(c.stdout, '');
102+
assert.strictEqual(c.stderr, '');
103103

104-
assert.strictEqual(c.status, 0, `code === ${c.status}`);
104+
assert.strictEqual(c.status, 0);
105105
});
106106

107107
// should throw if code piped from stdin with --check has bad syntax
@@ -111,15 +111,15 @@ syntaxArgs.forEach(function(args) {
111111
const c = spawnSync(node, args, { encoding: 'utf8', input: stdin });
112112

113113
// stderr should include '[stdin]' as the filename
114-
assert(c.stderr.startsWith('[stdin]'), "stderr doesn't start with [stdin]");
114+
assert(c.stderr.startsWith('[stdin]'), `${c.stderr} starts with ${stdin}`);
115115

116116
// no stdout or stderr should be produced
117-
assert.strictEqual(c.stdout, '', 'stdout produced');
117+
assert.strictEqual(c.stdout, '');
118118

119119
// stderr should have a syntax error message
120-
assert(syntaxErrorRE.test(c.stderr), 'stderr incorrect');
120+
assert(syntaxErrorRE.test(c.stderr), `${syntaxErrorRE} === ${c.stderr}`);
121121

122-
assert.strictEqual(c.status, 1, `code === ${c.status}`);
122+
assert.strictEqual(c.status, 1);
123123
});
124124

125125
// should throw if -c and -e flags are both passed
@@ -129,7 +129,7 @@ syntaxArgs.forEach(function(args) {
129129
const cmd = [node, ...args].join(' ');
130130
exec(cmd, common.mustCall((err, stdout, stderr) => {
131131
assert.strictEqual(err instanceof Error, true);
132-
assert.strictEqual(err.code, 9, `code === ${err.code}`);
132+
assert.strictEqual(err.code, 9);
133133
assert(
134134
stderr.startsWith(
135135
`${node}: either --check or --eval can be used, not both`

0 commit comments

Comments
 (0)