Skip to content

Update the assert module summary to better describe the module#2799

Closed
daveboivin wants to merge 4 commits intonodejs:masterfrom
daveboivin:patch-1
Closed

Update the assert module summary to better describe the module#2799
daveboivin wants to merge 4 commits intonodejs:masterfrom
daveboivin:patch-1

Conversation

@daveboivin
Copy link
Copy Markdown
Contributor

The current wording "This module is used for writing unit tests for your applications, you can access it with require('assert')." implies that this module should only be used in development while unit testing.

The article "Error Handling in Node.js" by Joyent (https://www.joyent.com/developers/node/design/errors) uses the assert module in an efficient way to validate required function arguments.

The current wording "This module is used for writing unit tests for your applications, you can access it with require('assert')." implies that this module should only be used in development while unit testing.

The article "Error Handling in Node.js" by Joyent (https://www.joyent.com/developers/node/design/errors) uses the assert module in an efficient way to validate required function arguments.
@mscdex mscdex added assert Issues and PRs related to the assert subsystem. doc Issues and PRs related to the documentations. labels Sep 10, 2015
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While we're at it, can you fix the comma splice? This modules is used for testing actual values against expected values. You can...

Correct comma splice
@Fishrock123
Copy link
Copy Markdown
Contributor

LGTM

@Trott
Copy link
Copy Markdown
Member

Trott commented Sep 12, 2015

I don't know if I'm getting to nit-picky, but to me, the new sentence doesn't convey the right ideas about assertions. While it's true that assertions are used for testing actual values against expected values, it's also used to confirm that a piece of code throws an error, for example.

Furthermore, the new wording may make it sound like assertions should be used as a general tool for comparing values, like it's a substitute for if (a === b) or something like that.

I feel like I do this on every single PR that has the doc tag, so apologies, but any thoughts from @nodejs/documentation ?

@Trott
Copy link
Copy Markdown
Member

Trott commented Sep 12, 2015

The more I'm thinking about it, the more I think that although the original wording is imperfect for sure, it does a better job of conveying when you might use an assertion and at least implying that there's something special about them and that they are not a general library for comparing values.

@Trott
Copy link
Copy Markdown
Member

Trott commented Sep 12, 2015

Perhaps a good summary of the utility of the module might be inspired by looking at the Wikipedia article on assertions.

@daveboivin
Copy link
Copy Markdown
Contributor Author

Good point @Trott. I'll figure out some wording that is accurate for the entire module.

Keep the summary simple while describing the entire module.
@daveboivin
Copy link
Copy Markdown
Contributor Author

Any thoughts on this @Trott ?

@Trott
Copy link
Copy Markdown
Member

Trott commented Oct 6, 2015

LGTM

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please wrap at 80 chars. 92 is definately too much :)

@silverwind
Copy link
Copy Markdown
Contributor

Oh, and a descriptive commit title would be nice too. Just rename the PR if you're lazy and I'll commit it as that :)

@daveboivin daveboivin changed the title Update assert.markdown Update the assert module summary to better describe the module Oct 9, 2015
silverwind pushed a commit that referenced this pull request Oct 11, 2015
The current wording "This module is used for writing unit tests for your
applications, you can access it with require('assert')." implies that
this module should only be used in development while unit testing.

The article "Error Handling in Node.js" by Joyent
(https://www.joyent.com/developers/node/design/errors) uses the assert
module in an efficient way to validate required function arguments.

PR-URL: #2799
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
@silverwind
Copy link
Copy Markdown
Contributor

Landed in 8e21309.

There were a lot of things wrong here which I had to correct (patch didn't merge, commit message lines weren't wrapped). Please read CONTRIBUTING.md next time 😉.

@silverwind silverwind closed this Oct 11, 2015
Trott pushed a commit to Trott/io.js that referenced this pull request Oct 12, 2015
The current wording "This module is used for writing unit tests for your
applications, you can access it with require('assert')." implies that
this module should only be used in development while unit testing.

The article "Error Handling in Node.js" by Joyent
(https://www.joyent.com/developers/node/design/errors) uses the assert
module in an efficient way to validate required function arguments.

PR-URL: nodejs#2799
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
jasnell pushed a commit that referenced this pull request Oct 12, 2015
The current wording "This module is used for writing unit tests for your
applications, you can access it with require('assert')." implies that
this module should only be used in development while unit testing.

The article "Error Handling in Node.js" by Joyent
(https://www.joyent.com/developers/node/design/errors) uses the assert
module in an efficient way to validate required function arguments.

PR-URL: #2799
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

assert Issues and PRs related to the assert subsystem. doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants