Skip to content
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

Merged
merged 2 commits into from Feb 13, 2022
Merged

Cleanup test output #715

merged 2 commits into from Feb 13, 2022

Conversation

Andarist
Copy link
Member

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Dec 16, 2021

鈿狅笍 No Changeset found

Latest commit: 7181c05

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 16, 2021

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:

Sandbox Source
Vanilla Configuration

@@ -22,6 +23,7 @@ const writeChangesets = (changesets: Changeset[], cwd: string) => {
};

jest.setTimeout(10000);
silenceLogsInBlock();
Copy link
Member Author

@Andarist Andarist Dec 16, 2021

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"~

Comment on lines +104 to +105
childProcess.on("stdout", data => process.stdout.write(data));
childProcess.on("stderr", data => process.stderr.write(data));
Copy link
Member Author

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);
Copy link
Member Author

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

Comment on lines +18 to +24
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;
Copy link
Member Author

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;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# Conflicts:
#	packages/get-dependents-graph/src/get-dependency-graph.test.ts
@Andarist Andarist merged commit db3acf2 into main Feb 13, 2022
@Andarist Andarist deleted the cleanup-test-output branch February 13, 2022 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants