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: adding mustCall in test-fs-readfile-empty.js #27455

Closed
wants to merge 6 commits into from
Closed

test: adding mustCall in test-fs-readfile-empty.js #27455

wants to merge 6 commits into from

Conversation

chenjian-bzh
Copy link
Contributor

@chenjian-bzh chenjian-bzh commented Apr 28, 2019

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Apr 28, 2019
@ZYSzys ZYSzys added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Apr 28, 2019

const fn = fixtures.path('empty.txt');

fs.readFile(fn, function(err, data) {
fs.readFile(fn, mustCall(function (err, data) {
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove the space after function:
function (err, data) -> function(err, data)

@@ -27,20 +27,21 @@ require('../common');
const assert = require('assert');
const fs = require('fs');
const fixtures = require('../common/fixtures');
const { mustCall } = require('../common')
Copy link
Member

Choose a reason for hiding this comment

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

Hi, missing semicolon here:

Suggested change
const { mustCall } = require('../common')
const { mustCall } = require('../common');

Besides, remember to remove the duplicated require('..common'); in line 23 above if you require('../common') here.

@Trott
Copy link
Member

Trott commented Apr 28, 2019

Nit/note for whoever lands this: Please change adding to imperative form add in the first line of the commit message when landing.

@nodejs-github-bot
Copy link
Collaborator

@@ -20,27 +20,27 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
Copy link
Member

Choose a reason for hiding this comment

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

The common module should be required in tests before any other module: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#lines-1-3

I’m a little surprised that the linter didn’t pick this up.

Copy link
Member

Choose a reason for hiding this comment

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

Me too... 🤔

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.

common must be required before anything else

@nodejs-github-bot
Copy link
Collaborator

@oyyd
Copy link
Contributor

oyyd commented Apr 30, 2019

Landed in 9c2774e, thanks!

You can visit https://www.nodetodo.org/next-steps/ for more ideas to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

9 participants