-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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: cleanup test-stdout-close-catch.js #10006
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
'use strict'; | ||
var common = require('../common'); | ||
var assert = require('assert'); | ||
var path = require('path'); | ||
var child_process = require('child_process'); | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const path = require('path'); | ||
const child_process = require('child_process'); | ||
|
||
var testScript = path.join(common.fixturesDir, 'catch-stdout-error.js'); | ||
const testScript = path.join(common.fixturesDir, 'catch-stdout-error.js'); | ||
|
||
var cmd = JSON.stringify(process.execPath) + ' ' + | ||
JSON.stringify(testScript) + ' | ' + | ||
JSON.stringify(process.execPath) + ' ' + | ||
'-pe "process.stdin.on(\'data\' , () => process.exit(1))"'; | ||
const cmd = JSON.stringify(process.execPath) + ' ' + | ||
JSON.stringify(testScript) + ' | ' + | ||
JSON.stringify(process.execPath) + ' ' + | ||
'-pe "process.stdin.on(\'data\' , () => process.exit(1))"'; | ||
|
||
var child = child_process.exec(cmd); | ||
var output = ''; | ||
var outputExpect = { 'code': 'EPIPE', | ||
const child = child_process.exec(cmd); | ||
let output = ''; | ||
const outputExpect = { 'code': 'EPIPE', | ||
'errno': 'EPIPE', | ||
'syscall': 'write' }; | ||
|
||
child.stderr.on('data', function(c) { | ||
output += c; | ||
}); | ||
|
||
child.on('close', function(code) { | ||
|
||
child.on('close', common.mustCall(function(code) { | ||
try { | ||
output = JSON.parse(output); | ||
} catch (er) { | ||
|
@@ -31,4 +32,4 @@ child.on('close', function(code) { | |
|
||
assert.deepStrictEqual(output, outputExpect); | ||
console.log('ok'); | ||
}); | ||
}), 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. I'll fix that. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think these lines should probably be indented as well.
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.
@cjihrig - thanks for looking at this.
I'm perfectly happy to align to any coding style, however, what is the style to be? make lint didn't make a peep over the alignment of these lines. My own style would be to indent these lines like so:
but I don't know if that's the indentation you'd like to see.
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.
@furnox What you have as your preference there is fine. (That's my preference too but it's not universal on the project. Basically, as long as the property names are lined up, that's the main thing.)
When we get over a couple of issues that are preventing us from updating ESLint, we will have more strict linting for indentation. Thanks for bearing with us until then.
Also, while you're in here editing: it seems like the quotation marks around the property names are unnecessary. If I'm not mistaken, it could be written as:
If there's a good reason for the quotation marks, then I guess keep them, but if not, perhaps take this opportunity to remove them.