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,doc: document where common modules go #16089

Closed
wants to merge 1 commit into from

Conversation

gibfahn
Copy link
Member

@gibfahn gibfahn commented Oct 8, 2017

Keep the require('../common') separate from other common modules, as
it's the only line that must be there.

I noticed that in the code-and-learn PRs, people are putting the require('../common/fixtures') require in with the normal ones. I think this is the right place to put it, but I'm open to suggestions.

Also the fixtures module isn't actually used in this example test, I could probably find another test that uses it, but will bloat the diff for questionable gain (making the lint pass on the sample test).

cc/ @nodejs/testing

Checklist
Affected core subsystem(s)

test

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Oct 8, 2017
@gibfahn gibfahn added the test Issues and PRs related to the tests. label Oct 8, 2017
Trott
Trott previously approved these changes Oct 9, 2017
@Fishrock123
Copy link
Contributor

I feel like this probably isn't correct - wouldn't we want tests-specific helper modules all imported at the top?

Also, maybe the example can actually use fixtures somehow? It's probably just going to be confusing having it there with no purpose. :/

@gibfahn
Copy link
Member Author

gibfahn commented Oct 9, 2017

I feel like this probably isn't correct - wouldn't we want tests-specific helper modules all imported at the top?

See:

Keep the require('../common') separate from other common modules, as it's the only line that must be there.

I originally had it with the main common line, but AIUI the reason that is at the top is because it's mandatory due to global checking etc. Requiring fixtures is just another module. Open to discuss though.

Also, maybe the example can actually use fixtures somehow? It's probably just going to be confusing having it there with no purpose. :/

See:

Also the fixtures module isn't actually used in this example test, I could probably find another test that uses it, but will bloat the diff for questionable gain (making the lint pass on the sample test).

We'd probably want to change the whole test, and frankly this is there as an example test, it doesn't need to use everything it contains, it should contain all the stuff you might want to use. So I considered it but decided not to bother. Thoughts?

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Oct 9, 2017

this is there as an example test, it doesn't need to use everything it contains

Maybe, in this case, we can add

// ...

at the end of the example?

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.

I could go either way on this. Fine with this, or fine with something else. Either way, we should probably build a lint rule for it rather than leave it to manual nits. (Or don't document it and accept that people can put it in multiple places.)

@Trott Trott dismissed their stale review October 11, 2017 02:35

Kinda neutral on this to be honest...

Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

No strong opinion but LGTM

@BridgeAR
Copy link
Member

+1 for a lint rule for this!

server.close(); // 19
})); // 20
}); // 21
const fixtures = require('../common/fixtures'); // 8
Copy link
Contributor

Choose a reason for hiding this comment

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

can we at least move this to either above or below the core module imports?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we should just put it under the require('common') line then, so all the common modules are in the same place.

Keep the `require('../common')` separate from other common modules, as
it's the only line that must be there.
@gibfahn
Copy link
Member Author

gibfahn commented Nov 2, 2017

@Fishrock123 updated, PTAL.

@gibfahn
Copy link
Member Author

gibfahn commented Nov 20, 2017

jasnell pushed a commit that referenced this pull request Nov 22, 2017
Keep the `require('../common')` separate from other common modules, as
it's the only line that must be there.

PR-URL: #16089
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell
Copy link
Member

jasnell commented Nov 22, 2017

Landed in 17db46c

@jasnell jasnell closed this Nov 22, 2017
@gibfahn gibfahn deleted the guide-fixtures branch November 22, 2017 20:08
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
Keep the `require('../common')` separate from other common modules, as
it's the only line that must be there.

PR-URL: #16089
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
Keep the `require('../common')` separate from other common modules, as
it's the only line that must be there.

PR-URL: #16089
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Dec 12, 2017
gibfahn added a commit that referenced this pull request Dec 19, 2017
Keep the `require('../common')` separate from other common modules, as
it's the only line that must be there.

PR-URL: #16089
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
@gibfahn gibfahn mentioned this pull request Dec 20, 2017
gibfahn added a commit that referenced this pull request Dec 20, 2017
Keep the `require('../common')` separate from other common modules, as
it's the only line that must be there.

PR-URL: #16089
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
@gibfahn gibfahn mentioned this pull request Dec 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants