-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* display current time when mini & verbose reporters finish I'm using toLocaleTimeString() which works even back to Node.js 0.10. Forcing a 24-hour clock because we're geeks. * watcher: restart logger on subsequent runs The CLI starts the logger so the watcher shouldn't reset it on its first run. Restart the logger after resetting, this allows the mini reporter to render its spinner. * better api.run stub in watcher test Return an object for the runStatus, add assertions to verify this object is passed to logger.finish() * assert that r/rs reruns all tests * clear mini reporter in watch mode Clear the mini reporter unless the previous run had failures, or "r\n" was entered on stdin. * consistent empty lines in finish output Always print two empty lines before each error/rejection/exception when the mini and verbose reporters finish. Remove trailing whitespace from stack traces. Always print an empty line after the finish output. Add a test helper to more easily compare line output, with useful debug information. At the moment this new helper is only used for failing tests. * print line if reporter was not be cleared Watch mode won't clear the mini reporter if there were errors, or "r\n" was entered on stdin. The verbose reporter can't be cleared at all. To improve the separation between multiple test runs, write a horizontal line when starting a new test run and the reporter was not cleared. * remove debug output from cli test
- Loading branch information
1 parent
a3565fd
commit 95a5c97
Showing
11 changed files
with
462 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
var SKIP_UNTIL_EMPTY_LINE = {}; | ||
|
||
function compareLineOutput(t, actual, lineExpectations) { | ||
var actualLines = actual.split('\n'); | ||
|
||
var expectationIndex = 0; | ||
var lineIndex = 0; | ||
while (lineIndex < actualLines.length && expectationIndex < lineExpectations.length) { | ||
var line = actualLines[lineIndex++]; | ||
var expected = lineExpectations[expectationIndex++]; | ||
if (expected === SKIP_UNTIL_EMPTY_LINE) { | ||
lineIndex = actualLines.indexOf('', lineIndex); | ||
continue; | ||
} | ||
|
||
if (typeof expected === 'string') { | ||
// Assertion titles use 1-based line indexes | ||
t.is(line, expected, 'line ' + lineIndex + ' ≪' + line + '≫ is ≪' + expected + '≫'); | ||
} else { | ||
t.match(line, expected, 'line ' + lineIndex + ' ≪' + line + '≫ matches ' + expected); | ||
} | ||
} | ||
} | ||
|
||
module.exports = compareLineOutput; | ||
compareLineOutput.SKIP_UNTIL_EMPTY_LINE = SKIP_UNTIL_EMPTY_LINE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.