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: increase coverage for internal/module.js #13673

Closed
wants to merge 1 commit into from

Conversation

TamasHodi
Copy link
Contributor

@TamasHodi TamasHodi commented Jun 14, 2017

Add tests for the stripShebang function.

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

test internal modules

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Jun 14, 2017
@TamasHodi
Copy link
Contributor Author

Tests should be fine but i was not able to run them locally.
Is there any way to do that without getting Error: Cannot find module for the required internal module?
I really would like to put the last tick there. :)

@refack
Copy link
Contributor

refack commented Jun 14, 2017

Tests should be fine but i was not able to run them locally.
Is there any way to do that without getting Error: Cannot find module for the required internal module?
I really would like to put the last tick there. :)

Both an answer and a nit: Add // Flags: --expose-internals as the first line in the test file (Example: test/parallel/test-buffer-fill.js). That will tell test.py to call node with the --expose-internals flag. You can also directly test the file with node --expose-internals test/parallel/test-internal-modules.js.

@refack refack added the module Issues and PRs related to the module subsystem. label Jun 14, 2017
@refack
Copy link
Contributor

refack commented Jun 14, 2017

Ohh and P.S. 😉
@TamasHodi thank you very much for the contribution 🥇

@TamasHodi TamasHodi force-pushed the master branch 2 times, most recently from 75caabb to afe49c2 Compare June 14, 2017 13:21
@TamasHodi
Copy link
Contributor Author

TamasHodi commented Jun 14, 2017

@refack Thanks for the help! Well, Im going to read the docs next time :P
Btw ive cleaned up the tests so its ready for review.

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

Could you add these changes in a separate file. I don't think we want to lose the things that are currently removed in this PR.

require(path.join(common.fixturesDir, 'internal-modules')),
42
internalModule.stripShebang('#!bin/bash\naa'),
'\naa'
Copy link
Member

Choose a reason for hiding this comment

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

Something like the following would be far more compact (and likely easier to maintain):

[
  ['', ''],
  ['aa', 'aa'],
  ['#!', ''],
  ['#!bin/bash', ''],
  ['#!bin/bash\naa', '\naa']
].forEach((i) => assert.strictEqual(internalModule.stripShebang(i[0]), i[1]));

@TamasHodi
Copy link
Contributor Author

@cjihrig I've restored the original test file which was intended to check the availability of the internal modules and moved my refactored tests into a new file.

@refack
Copy link
Contributor

refack commented Jun 14, 2017

@refack refack self-assigned this Jun 14, 2017
@TamasHodi
Copy link
Contributor Author

I've just seen the failing OSX test/build. Did i miss something?
The console output doesn't say that much for me as a newbie. :)

@refack
Copy link
Contributor

refack commented Jun 15, 2017

I've just seen the failing OSX test/build. Did i miss something?
The console output doesn't say that much for me as a newbie. :)

Don't worry, it's unrelated.

@refack refack removed their assignment Jun 16, 2017
jasnell pushed a commit that referenced this pull request Jun 16, 2017
PR-URL: #13673
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@jasnell
Copy link
Member

jasnell commented Jun 16, 2017

Landed in 83ebb6d

@jasnell jasnell closed this Jun 16, 2017
@refack
Copy link
Contributor

refack commented Jun 16, 2017

@TamasHodi congradulations on landing your first contribution
image
After refresh
image
Many happy returns 😉

addaleax pushed a commit that referenced this pull request Jun 17, 2017
PR-URL: #13673
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@addaleax addaleax mentioned this pull request Jun 17, 2017
addaleax pushed a commit that referenced this pull request Jun 21, 2017
PR-URL: #13673
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module Issues and PRs related to the module subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants