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

Fix 11826 #11920

Closed
wants to merge 9 commits into from
Closed

Fix 11826 #11920

wants to merge 9 commits into from

Conversation

clarenced
Copy link
Contributor

@clarenced clarenced commented Mar 18, 2017

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows [commit guidelines][]
Affected core subsystem(s)

test, domain

@clarenced
Copy link
Contributor Author

@Trott and @gibfahn Here is the PR for the issue #11826.

@mscdex
Copy link
Contributor

mscdex commented Mar 18, 2017

Perhaps it would be better to combine all of the tests (including the childShouldNotThrowAndAbort() implementation) into one file?

@mscdex mscdex added the domain Issues and PRs related to the domain subsystem. label Mar 18, 2017
@clarenced
Copy link
Contributor Author

@mscdex I got inspire by what was done in the PR #10329

@mscdex
Copy link
Contributor

mscdex commented Mar 19, 2017

Yeah I don't agree with that PR's test splitting either. It's quite unnecessary IMHO. All that's needed is to run each test sequentially instead of in parallel. This can be done quite easily by actually keeping the forEach() but using execSync() instead of exec() to spawn the child process for each test.

@Trott
Copy link
Member

Trott commented Mar 19, 2017

Can you please add documentation for the new common function to test/README.md?

@Trott
Copy link
Member

Trott commented Mar 19, 2017

Shouldn't this delete the existing test file as it is being replaced by 13 individual test files?

@Trott
Copy link
Member

Trott commented Mar 19, 2017

@mscdex wrote:

Yeah I don't agree with that PR's test splitting either.

Maybe it would be good for @nodejs/testing to reconvene and try to come up with some test organization guidelines that might be useful in cases like this.

I personally prefer lots of short test files that are very specific over long and monolithic test files that are more likely to have tests suffer from side effects from other tests in the file and so on. But this file isn't that long to begin with so ¯\(ツ)/¯.

test/README.md Outdated
@@ -410,6 +410,10 @@ The realpath of the 'tmp' directory.

Name of the temp directory used by tests.

### childShouldNotThrowAndAbort
Copy link
Member

Choose a reason for hiding this comment

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

Nit: should be childShouldNotThrowAndAbort()

test/common.js Outdated
const child = child_process.exec(testCmd);
child.on('exit', (code, signal) => {
const errorMsg = `Test should have exited with exit code 0
but insteand exited with code ${code} and signal ${signal}`;
Copy link
Member

Choose a reason for hiding this comment

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

The multiline string literal is likely going to be problematic because the additional whitespace is preserved. Can you make this the following instead:

const errorMessage = 'Test should have exited with exit code 0 but instead ' +
                                    `exited with ${code} and signal ${signal}`;

Generally speaking we do not use multiline string literals in core code

Copy link
Contributor

Choose a reason for hiding this comment

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

@jasnell Is that extra indentation unintentional?

Copy link
Member

Choose a reason for hiding this comment

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

no, not intentional on the extra indentation.

test/README.md Outdated
@@ -410,6 +410,10 @@ The realpath of the 'tmp' directory.

Name of the temp directory used by tests.

### childShouldNotThrowAndAbort
This test makes sure that when using --abort-on-uncaught-exception and when throwing an error
Copy link
Contributor

Choose a reason for hiding this comment

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

--abort-on-uncaught-exception should be in backticks I think.

test/common.js Outdated
@@ -250,6 +250,28 @@ exports.childShouldThrowAndAbort = function() {
});
};


// This test makes sure that when using --abort-on-uncaught-exception and
Copy link
Contributor

Choose a reason for hiding this comment

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

s/test/function/

@clarenced
Copy link
Contributor Author

I have the changes as suggested

test/README.md Outdated
@@ -410,6 +410,10 @@ The realpath of the 'tmp' directory.

Name of the temp directory used by tests.

### childShouldNotThrowAndAbort()
This test makes sure that when using `--abort-on-uncaught-exception` and when throwing an error
Copy link
Member

Choose a reason for hiding this comment

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

There's an unnecessary indent on these two lines


d.once('error', (err) => {
errorHandlerCalled = true;
});
Copy link
Member

Choose a reason for hiding this comment

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

The errorHandlerCalled can be replaced by using common.mustCall() ...e.g.

d.once('error', common.mustCall(() => {}));

@clarenced
Copy link
Contributor Author

New changes submitted

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

@jasnell’s comment on test/README.md should still be addressed, but otherwise LGTM. Thank you!

@aqrln
Copy link
Contributor

aqrln commented Apr 15, 2017

@jasnell
Copy link
Member

jasnell commented Apr 17, 2017

@cjihrig ... PTAL when you get a moment

test/README.md Outdated
@@ -412,6 +412,9 @@ The realpath of the 'tmp' directory.

Name of the temp directory used by tests.

### childShouldNotThrowAndAbort()
This test makes sure that when using `--abort-on-uncaught-exception` and when throwing an error from within a domain that has an error handler setup, the process _does not_ abort.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a newline here, and wrap the line at 80 characters.

Copy link
Contributor Author

@clarenced clarenced Apr 17, 2017

Choose a reason for hiding this comment

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

@cjihrig Sorry what do you mean by naming the temp directory used by tests? I am a little confused here

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant a blank line between ### childShouldNotThrowAndAbort() and the following paragraph. Also, lines should be 80 characters long. I'm not sure what you mean by temp directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I misread your comment, I thought Name of the temp directory used by tests. was part of your comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I submitted the changes as suggested

@Trott
Copy link
Member

Trott commented Jun 14, 2017

@clarenced Any chance you can rebase this to eliminate the conflicts? (The biggest issue you are likely to run into is that the stuff you put in test/README.md and test/common.js now goes in test/common/README.md and test/common/index.js.)

If that happens, I'll give it another review and try to loop in @cjihrig to get this unstuck.

@cjihrig cjihrig dismissed their stale review June 14, 2017 20:50

@clarenced just let me know when/if you rebase this. Happy to take another look. Dismissing my review for now

@Trott
Copy link
Member

Trott commented Jul 30, 2017

This seems to be stalled. I'm going to close it. By all means, if you're still working on this, please comment to that effect. Thanks!

@Trott Trott closed this Jul 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain Issues and PRs related to the domain subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants