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: assert.strictEqual and linting #10036

Closed
wants to merge 2 commits into from
Closed

test: assert.strictEqual and linting #10036

wants to merge 2 commits into from

Conversation

furnox
Copy link
Contributor

@furnox furnox commented Dec 1, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

Updated assert.equal to assert.strictEqual
Updated 'var' to 'const'

Updated assert.equal to assert.strictEqual
Updated 'var' to 'const'
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 1, 2016
@imyller imyller added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Dec 1, 2016

var cmd = '"' + nodePath + '" "' + script + '" | head -2';
const cmd = '"' + nodePath + '" "' + script + '" | head -2';
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good candidate for a template string.


var cmd = '"' + nodePath + '" "' + script + '" | head -2';
const cmd = '"' + nodePath + '" "' + script + '" | head -2';

exec(cmd, common.mustCall(function(err, stdout, stderr) {
if (err) throw err;
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be assert.ifError(err);

@mscdex mscdex added the child_process Issues and PRs related to the child_process subsystem. label Dec 3, 2016
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 with @cjihrig's suggestions

@Trott
Copy link
Member

Trott commented Dec 8, 2016

@Trott
Copy link
Member

Trott commented Dec 22, 2016

Ping @furnox: Any chance you can update this to reflect the comments from @cjihrig?

@furnox
Copy link
Contributor Author

furnox commented Dec 22, 2016

@Trott I had a question about that that seemed to be made moot by the pr approval and lack of a formal request.

Respectfully, what would the expectation be if one had a burr under their saddle to go through and update all the tests and convert all the "var" statements to something more modern and appropriate? Would the attitude be that incremental change in the right direction is better than no change, or would that pr be plagued by "while in there you should have..." or "this unrelated code ought be be changed too"?

Now, I want to contribute and I'll make these changes, but, frankly, if every time I pull a thread certain people aren't going to be happy unless I pull enough thread to make another sweater, I'm not going to be real inclined to pull any threads.

@Trott
Copy link
Member

Trott commented Dec 22, 2016

Respectfully, what would the expectation be if one had a burr under their saddle to go through and update all the tests and convert all the "var" statements to something more modern and appropriate?

(My viewpoint only below. Others may see things differently.)

Currently, that would mean updating 876 files. The relatively modest value of the change combined with the risk of introducing subtle bugs and the difficulty of adequately reviewing such a large change means that doing all 876 files in a single PR would be unlikely to be accepted.

For better or worse, the approach of the project to updating var to const or let in tests has been to do it incidentally while one is already making other changes to a test. There are certainly arguments against that approach and I myself dislike it quite a bit to be honest. (That said, the project is run on consensus and the appropriate approach to updating tests from var to const and let is not a battle I choose to fight.)

My approach has been to not worry much about var to const and let in tests and to consider those 876 files as 876 good first commits for newcomers.

That said, there is currently at least one person going through the tests one at a time and updating var to let and const while also changing assert.equal() to assert.strictEqual(). I'm neutral on that approach, but it seems to be working for them. Their PRs seem to get approved. So maybe consider that approach?

@Trott
Copy link
Member

Trott commented Dec 22, 2016

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

LGTM if CI is ✅

@italoacasas
Copy link
Contributor

Landed 7c9dc5d

italoacasas pushed a commit that referenced this pull request Dec 23, 2016
- Updated assert.equal to assert.strictEqual
- Updated 'var' to 'const'
- Using template literals

PR-URL: #10036
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Italo A. Casas <[email protected]>
@Trott
Copy link
Member

Trott commented Dec 23, 2016

Thanks for the contribution @furnox! 🎉

targos pushed a commit that referenced this pull request Dec 26, 2016
- Updated assert.equal to assert.strictEqual
- Updated 'var' to 'const'
- Using template literals

PR-URL: #10036
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Italo A. Casas <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Dec 27, 2016
targos pushed a commit that referenced this pull request Dec 28, 2016
- Updated assert.equal to assert.strictEqual
- Updated 'var' to 'const'
- Using template literals

PR-URL: #10036
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Italo A. Casas <[email protected]>
evanlucas pushed a commit that referenced this pull request Jan 3, 2017
- Updated assert.equal to assert.strictEqual
- Updated 'var' to 'const'
- Using template literals

PR-URL: #10036
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Italo A. Casas <[email protected]>
evanlucas pushed a commit that referenced this pull request Jan 4, 2017
- Updated assert.equal to assert.strictEqual
- Updated 'var' to 'const'
- Using template literals

PR-URL: #10036
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Italo A. Casas <[email protected]>
targos pushed a commit that referenced this pull request Jan 23, 2017
- Updated assert.equal to assert.strictEqual
- Updated 'var' to 'const'
- Using template literals

PR-URL: #10036
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Italo A. Casas <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
- Updated assert.equal to assert.strictEqual
- Updated 'var' to 'const'
- Using template literals

PR-URL: #10036
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Italo A. Casas <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jan 24, 2017
MylesBorins pushed a commit that referenced this pull request Feb 1, 2017
- Updated assert.equal to assert.strictEqual
- Updated 'var' to 'const'
- Using template literals

PR-URL: #10036
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Italo A. Casas <[email protected]>
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. code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants