Skip to content

Commit

Permalink
test: improved test messages for assertStdout
Browse files Browse the repository at this point in the history
the messages didn't make any sense when the test was not failing
  • Loading branch information
karfau committed Jan 7, 2020
1 parent 64d6a77 commit a883153
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test.command.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ export const assertStdout = (
) =>
/** @param {CommandResponse} it */
({code, killed, signal, stderr, stdout}) => {
t.assertNot((killed || signal), `command was killed with '${signal}'`);
t.assertNot(code, `unexpected exit code '${code}'`);
t.assertNot((killed || signal), `expected no kill signal (was '${signal}')`);
t.assertNot(code, `expected no exit code (was '${code}')`);
stderr = stderr.trim();
t.equals(stderr, '', `unexpected stderr: "${stderr.split('\n')[0]}[...]"`);
t.equals(
stderr, '', `expected empty stderr (1st line: "${stderr.split('\n')[0]}")`
);
test(stdout.trim(), stdoutAssertion, 'expected stdout');
}

0 comments on commit a883153

Please sign in to comment.