0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00

test: improve assert messages

PR-URL: https://github.com/nodejs/node/pull/15972
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Eric Pemberton 2017-10-06 10:38:56 -07:00 committed by Ruben Bridgewater
parent 96eba098ef
commit 55bb9c4128
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -53,7 +53,8 @@ try {
assert.strictEqual(e.errno, 'ETIMEDOUT');
err = e;
} finally {
assert.strictEqual(ret, undefined, 'we should not have a return value');
assert.strictEqual(ret, undefined,
`should not have a return value, received ${ret}`);
assert.strictEqual(caught, true, 'execSync should throw');
const end = Date.now() - start;
assert(end < SLEEP);
@ -74,11 +75,11 @@ cmd = `"${process.execPath}" -e "console.log('${msg}');"`;
ret = execSync(cmd);
assert.strictEqual(ret.length, msgBuf.length);
assert.deepStrictEqual(ret, msgBuf, 'execSync result buffer should match');
assert.deepStrictEqual(ret, msgBuf);
ret = execSync(cmd, { encoding: 'utf8' });
assert.strictEqual(ret, `${msg}\n`, 'execSync encoding result should match');
assert.strictEqual(ret, `${msg}\n`);
const args = [
'-e',
@ -90,8 +91,7 @@ assert.deepStrictEqual(ret, msgBuf);
ret = execFileSync(process.execPath, args, { encoding: 'utf8' });
assert.strictEqual(ret, `${msg}\n`,
'execFileSync encoding result should match');
assert.strictEqual(ret, `${msg}\n`);
// Verify that the cwd option works - GH #7824
{