Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added a quiet mode printer to versioned-tests (#201)
- Loading branch information
1 parent
0f40f8b
commit 9477251
Showing
3 changed files
with
53 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2024 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
const TestPrinter = require('./printer') | ||
|
||
/** | ||
* A printer that will only write output to the destination stream when | ||
* an error has occurred in a test suite. | ||
*/ | ||
class QuietPrinter extends TestPrinter { | ||
constructor(tests, options) { | ||
super(tests, options) | ||
} | ||
|
||
print() { | ||
// This method is required by TestPrinter.maybePrint, but we don't need | ||
// to do anything. | ||
} | ||
|
||
update(test, status) { | ||
// This method is used by the runner to update the status of a test. | ||
// We only care if the test has failed. If it has, then indicate that | ||
// the output should be printed. | ||
const failed = this._isFailure(status) === true | ||
this._doUpdate(test, status, failed === true) | ||
} | ||
} | ||
|
||
module.exports = QuietPrinter |