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: coverage for internal util.emitExperimentalWarning #17635

Closed
wants to merge 1 commit into from
Closed

test: coverage for internal util.emitExperimentalWarning #17635

wants to merge 1 commit into from

Conversation

mithunsasidharan
Copy link
Contributor

@mithunsasidharan mithunsasidharan commented Dec 12, 2017

Added missing coverage for method emitExperimentalWarning in internal/utils.js.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 12, 2017

// This test ensures that the emitExperimentalWarning in internal/util emits a
// warning when passed a unsupported feature and that it simply returns when
// passed a supported feature.
Copy link
Member

Choose a reason for hiding this comment

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

The description isn't correct. The second part "and that it simply returns when passed a supported feature." should say "and that it simply returns when passed the same feature multiple times."

Can this also be moved after the require below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@apapirovski : Thanks for the feedback. I've updated the PR. Kindly review now.

assert(/is an experimental feature/.test(warning.message));
}, 2));
emitExperimentalWarning('feature1');
emitExperimentalWarning('feature1');
Copy link
Member

Choose a reason for hiding this comment

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

Could you add, at the end of the line, // should not warn

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@apapirovski : Thanks for the feedback. I've updated the PR. Kindly review now.

@apapirovski
Copy link
Member


process.on('warning', common.mustCall((warning) => {
assert(/is an experimental feature/.test(warning.message));
}, 2));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add an empty line in between the process.on('warning') and emitExperimentalWarning calls

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maclover7 : Thanks for the feedback. I've updated the PR. Kindly review now.


emitExperimentalWarning('feature1');
emitExperimentalWarning('feature1');
emitExperimentalWarning('feature2'); // should not warn
Copy link
Member

Choose a reason for hiding this comment

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

Seems like the comment is on the wrong line / the numbers got mixed up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BridgeAR : You're right.. my bad. I've fixed it now. Kindly review. Thanks !

const { emitExperimentalWarning } = require('internal/util');

// This test ensures that the emitExperimentalWarning in internal/util emits a
// warning when passed a unsupported feature and that it simply returns
Copy link
Member

Choose a reason for hiding this comment

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

Nit: :%s/a/an ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lpinca : Good catch. I've updated it. Thanks !

@apapirovski
Copy link
Member

@apapirovski
Copy link
Member

Landed in 3a53f7c.

apapirovski pushed a commit that referenced this pull request Dec 17, 2017
PR-URL: #17635
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@mithunsasidharan mithunsasidharan deleted the pr_coverage branch December 18, 2017 05:04
MylesBorins pushed a commit that referenced this pull request Jan 8, 2018
PR-URL: #17635
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jan 9, 2018
PR-URL: #17635
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Jan 10, 2018
boingoing pushed a commit to nodejs/node-chakracore that referenced this pull request Jan 18, 2018
PR-URL: nodejs/node#17635
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2018
PR-URL: #17635
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
gibfahn pushed a commit that referenced this pull request Jan 24, 2018
PR-URL: #17635
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants