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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Improve test-child-process-stdout-flush #8581

Closed
wants to merge 1 commit into from

Conversation

wietsevenema
Copy link

Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

Description of change

Changed vars to const / let, functions to lambdas and a mustCall where appropriate.

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Sep 17, 2016
@eljefedelrodeodeljefe
Copy link
Contributor

Refers to nodejs/code-and-learn#56. Not sure if Anna has mentioned it otherwise, but please edit the commit message to meet the contribution guidelines, by adding a small line to change you made and what it refers to.

Otherwise LGTM

@mscdex mscdex added the child_process Issues and PRs related to the child_process subsystem. label Sep 17, 2016
Copy link
Contributor

@eljefedelrodeodeljefe eljefedelrodeodeljefe left a comment

Choose a reason for hiding this comment

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

Refers to nodejs/code-and-learn#56. Not sure if Anna has mentioned it otherwise, but please edit the commit message to meet the contribution guidelines, by adding a small line to change you made and what it refers to.

Otherwise LGTM

@wietsevenema
Copy link
Author

Changed commit message

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@princejwesley princejwesley left a comment

Choose a reason for hiding this comment

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

LGTM

@imyller
Copy link
Member

imyller commented Sep 20, 2016

@eljefedelrodeodeljefe Could you review again? I believe the changes you've requested have been made. Thank you.

@imyller
Copy link
Member

imyller commented Sep 20, 2016

@imyller imyller self-assigned this Sep 20, 2016

child.stderr.setEncoding('utf8');
child.stderr.on('data', function(data) {
child.stderr.on('data', (data) => {
console.log('parent stderr: ' + data);
assert.ok(false);
});
Copy link
Member

Choose a reason for hiding this comment

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

I would use common.fail here: child.stderr.on('data', common.fail);

console.log('parent stderr: ' + data);
assert.ok(false);
});

child.stdout.setEncoding('utf8');
child.stdout.on('data', function(data) {
child.stdout.on('data', (data) => {
count += data.length;
console.log(count);
Copy link
Member

Choose a reason for hiding this comment

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

I would remove the multiple console.log

console.log('okay');
});
}));
Copy link
Member

Choose a reason for hiding this comment

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

The close event listener has two arguments: code and signal. I would check that code is 0 and signal is not defined.

@jasnell
Copy link
Member

jasnell commented Sep 20, 2016

@wietsevenema ... I think this is almost there. Once this comments are addressed this should be good to go.

@wietsevenema
Copy link
Author

@jasnell Sure thing. Updated the commit and rebased with upstream

child.on('close', common.mustCall((code, signal) => {
assert.strictEqual(code, 0);
assert.strictEqual(signal, null);
assert.strictEqual(n, count);
console.log('okay');
Copy link
Member

Choose a reason for hiding this comment

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

Remove this log

Copy link
Member

Choose a reason for hiding this comment

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

I agree. This should be removed.

Copy link
Author

Choose a reason for hiding this comment

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

@santigimeno
Copy link
Member

LGTM with a nit

@santigimeno
Copy link
Member

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

LGTM

Changed vars to const / let, functions to lambdas and a mustCall where appropriate.
Copy link
Member

@imyller imyller left a comment

Choose a reason for hiding this comment

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

LGTM

jasnell pushed a commit that referenced this pull request Sep 20, 2016
Changed vars to const / let, functions to arrow functions and a
mustCall where appropriate.

PR-URL: #8581
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
@jasnell
Copy link
Member

jasnell commented Sep 20, 2016

Landed in 57a5136! Thank you!

@jasnell jasnell closed this Sep 20, 2016
@imyller imyller removed their assignment Sep 20, 2016
@imyller
Copy link
Member

imyller commented Sep 20, 2016

@jasnell, looks like we were both landing the same PR at the same time :)
I've now removed my assignment from this.

Thank you for your contribution, @wietsevenema

@jasnell
Copy link
Member

jasnell commented Sep 20, 2016

Sorry @imyller! I actually didn't see your assignment on there or I would have left it for you!

Fishrock123 pushed a commit that referenced this pull request Oct 11, 2016
Changed vars to const / let, functions to arrow functions and a
mustCall where appropriate.

PR-URL: #8581
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.