Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(init-config): makes stderr, stdout configurable - so we can …
…test their uses more easily (#897) ## Description - adds out & err stream parameters to the init config - updates tests so they test for what is written to them ## Motivation and Context - More reliable tests - Less stdout/ stderr poluting the standard test report ## How Has This Been Tested? - [x] green ci - [x] adapted automated non-regression tests ## Types of changes - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] Documentation only change - [x] Refactor (non-breaking change which fixes an issue without changing functionality) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change)
- Loading branch information
Showing
6 changed files
with
120 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* eslint-disable max-classes-per-file */ | ||
import { match } from "node:assert"; | ||
import { Writable } from "node:stream"; | ||
|
||
export class WritableTestStream extends Writable { | ||
expected = /^$/; | ||
|
||
/** | ||
* @param {RegExp=} pExpected | ||
*/ | ||
constructor(pExpected) { | ||
super(); | ||
if (pExpected) { | ||
this.expected = pExpected; | ||
} | ||
} | ||
write(pChunk) { | ||
match(pChunk, this.expected); | ||
return true; | ||
} | ||
} | ||
|
||
export class UnCalledWritableTestStream extends Writable { | ||
write(pChunk) { | ||
throw new Error(`Unexpected write to stream: ${pChunk}`); | ||
} | ||
} |
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