New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup test output #715
Cleanup test output #715
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 7181c05:
|
74f1d43
to
1db4ec9
Compare
@@ -22,6 +23,7 @@ const writeChangesets = (changesets: Changeset[], cwd: string) => { | |||
}; | |||
|
|||
jest.setTimeout(10000); | |||
silenceLogsInBlock(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the logs created by this test were especially noisy - cause they were logging all the executed git commands and stuff like that and made it harder (for me) to quickly check which tests failed etc
so this was my original motivation behind this "cleanup"~
childProcess.on("stdout", data => process.stdout.write(data)); | ||
childProcess.on("stderr", data => process.stderr.write(data)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is more correct because the received data doesn't have to end up with a new line
@@ -96,12 +97,12 @@ export async function execWithOutput( | |||
args: string[], | |||
options: { ignoreReturnCode?: boolean; cwd: string } | |||
) { | |||
console.log(`Running ${command} ${args.join(" ")}`); | |||
process.stdout.write(`Running: ${command} ${args.join(" ")}` + os.EOL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be just a console.log but I've matched the logging style from the callbacks below this
const originalConsoleError = console.error; | ||
const originalConsoleInfo = console.info; | ||
const originalConsoleLog = console.log; | ||
const originalConsoleWarn = console.warn; | ||
|
||
const originalStdoutWrite = process.stdout.write; | ||
const originalStderrWrite = process.stderr.write; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has a drawback - it might be harder to use console.log
in the "silenced" tests. I can live with that - WDYT?
|
||
export default function spawn( | ||
cmd: string, | ||
args: Array<string>, | ||
opts?: SpawnOptions | ||
): Promise<{ stdout: Buffer; code: number; stderr: Buffer }> & ChildProcess; | ||
): Promise<{ stdout: Buffer; code: number; stderr: Buffer }> & EventEmitter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the previous version was incorrect:
https://github.com/jamiebuilds/spawndamnit/blob/9fec44510749481dd11906f3a979ed9ebdda4fed/promise.js#L18
# Conflicts: # packages/get-dependents-graph/src/get-dependency-graph.test.ts
No description provided.