test: improve assert messages · nodejs/node@a93d3eb

@@ -32,7 +32,8 @@ try {

3232

assert.strictEqual(e.errno, 'ETIMEDOUT');

3333

err = e;

3434

} finally {

35-

assert.strictEqual(ret, undefined, 'we should not have a return value');

35+

assert.strictEqual(ret, undefined,

36+

`should not have a return value, received ${ret}`);

3637

assert.strictEqual(caught, true, 'execSync should throw');

3738

const end = Date.now() - start;

3839

assert(end < SLEEP);

@@ -53,11 +54,11 @@ cmd = `"${process.execPath}" -e "console.log('${msg}');"`;

5354

ret = execSync(cmd);

54555556

assert.strictEqual(ret.length, msgBuf.length);

56-

assert.deepStrictEqual(ret, msgBuf, 'execSync result buffer should match');

57+

assert.deepStrictEqual(ret, msgBuf);

57585859

ret = execSync(cmd, { encoding: 'utf8' });

596060-

assert.strictEqual(ret, `${msg}\n`, 'execSync encoding result should match');

61+

assert.strictEqual(ret, `${msg}\n`);

61626263

const args = [

6364

'-e',

@@ -69,8 +70,7 @@ assert.deepStrictEqual(ret, msgBuf);

69707071

ret = execFileSync(process.execPath, args, { encoding: 'utf8' });

717272-

assert.strictEqual(ret, `${msg}\n`,

73-

'execFileSync encoding result should match');

73+

assert.strictEqual(ret, `${msg}\n`);

74747575

// Verify that the cwd option works - GH #7824

7676

{