mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
test: modify test messages to template literals
PR-URL: https://github.com/nodejs/node/pull/15931 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
1 parent
7df8e0b0db
commit
5b29e5a1f3
1 file changed
+17
-17
@@ -33,8 +33,8 @@ const notFoundRE = /^Error: Cannot find module/m;
|
||||
const cmd = [node, ..._args].join(' ');
|
||||
exec(cmd, common.mustCall((err, stdout, stderr) => {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(stdout, '', 'stdout produced');
|
||||
assert.strictEqual(stderr, '', 'stderr produced');
|
||||
assert.strictEqual(stdout, '');
|
||||
assert.strictEqual(stderr, '');
|
||||
}));
|
||||
});
|
||||
});
|
||||
@@ -54,16 +54,16 @@ const notFoundRE = /^Error: Cannot find module/m;
|
||||
const cmd = [node, ..._args].join(' ');
|
||||
exec(cmd, common.mustCall((err, stdout, stderr) => {
|
||||
assert.strictEqual(err instanceof Error, true);
|
||||
assert.strictEqual(err.code, 1, `code === ${err.code}`);
|
||||
assert.strictEqual(err.code, 1);
|
||||
|
||||
// no stdout should be produced
|
||||
assert.strictEqual(stdout, '', 'stdout produced');
|
||||
assert.strictEqual(stdout, '');
|
||||
|
||||
// stderr should have a syntax error message
|
||||
assert(syntaxErrorRE.test(stderr), 'stderr incorrect');
|
||||
assert(syntaxErrorRE.test(stderr), `${syntaxErrorRE} === ${stderr}`);
|
||||
|
||||
// stderr should include the filename
|
||||
assert(stderr.startsWith(file), "stderr doesn't start with the filename");
|
||||
assert(stderr.startsWith(file), `${stderr} starts with ${file}`);
|
||||
}));
|
||||
});
|
||||
});
|
||||
@@ -81,12 +81,12 @@ const notFoundRE = /^Error: Cannot find module/m;
|
||||
const cmd = [node, ..._args].join(' ');
|
||||
exec(cmd, common.mustCall((err, stdout, stderr) => {
|
||||
// no stdout should be produced
|
||||
assert.strictEqual(stdout, '', 'stdout produced');
|
||||
assert.strictEqual(stdout, '');
|
||||
|
||||
// stderr should have a module not found error message
|
||||
assert(notFoundRE.test(stderr), 'stderr incorrect');
|
||||
assert(notFoundRE.test(stderr), `${notFoundRE} === ${stderr}`);
|
||||
|
||||
assert.strictEqual(err.code, 1, `code === ${err.code}`);
|
||||
assert.strictEqual(err.code, 1);
|
||||
}));
|
||||
});
|
||||
});
|
||||
@@ -98,10 +98,10 @@ syntaxArgs.forEach(function(args) {
|
||||
const c = spawnSync(node, args, { encoding: 'utf8', input: stdin });
|
||||
|
||||
// no stdout or stderr should be produced
|
||||
assert.strictEqual(c.stdout, '', 'stdout produced');
|
||||
assert.strictEqual(c.stderr, '', 'stderr produced');
|
||||
assert.strictEqual(c.stdout, '');
|
||||
assert.strictEqual(c.stderr, '');
|
||||
|
||||
assert.strictEqual(c.status, 0, `code === ${c.status}`);
|
||||
assert.strictEqual(c.status, 0);
|
||||
});
|
||||
|
||||
// should throw if code piped from stdin with --check has bad syntax
|
||||
@@ -111,15 +111,15 @@ syntaxArgs.forEach(function(args) {
|
||||
const c = spawnSync(node, args, { encoding: 'utf8', input: stdin });
|
||||
|
||||
// stderr should include '[stdin]' as the filename
|
||||
assert(c.stderr.startsWith('[stdin]'), "stderr doesn't start with [stdin]");
|
||||
assert(c.stderr.startsWith('[stdin]'), `${c.stderr} starts with ${stdin}`);
|
||||
|
||||
// no stdout or stderr should be produced
|
||||
assert.strictEqual(c.stdout, '', 'stdout produced');
|
||||
assert.strictEqual(c.stdout, '');
|
||||
|
||||
// stderr should have a syntax error message
|
||||
assert(syntaxErrorRE.test(c.stderr), 'stderr incorrect');
|
||||
assert(syntaxErrorRE.test(c.stderr), `${syntaxErrorRE} === ${c.stderr}`);
|
||||
|
||||
assert.strictEqual(c.status, 1, `code === ${c.status}`);
|
||||
assert.strictEqual(c.status, 1);
|
||||
});
|
||||
|
||||
// should throw if -c and -e flags are both passed
|
||||
@@ -129,7 +129,7 @@ syntaxArgs.forEach(function(args) {
|
||||
const cmd = [node, ...args].join(' ');
|
||||
exec(cmd, common.mustCall((err, stdout, stderr) => {
|
||||
assert.strictEqual(err instanceof Error, true);
|
||||
assert.strictEqual(err.code, 9, `code === ${err.code}`);
|
||||
assert.strictEqual(err.code, 9);
|
||||
assert(
|
||||
stderr.startsWith(
|
||||
`${node}: either --check or --eval can be used, not both`
|
||||
|
||||
Reference in new issue
Block a user