-
- Notifications
You must be signed in to change notification settings - Fork 33.7k
assert: make a small internal assert module for built-in use #25956
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Move lib/internal/assert.js to lib/internal/assert/assertion_error.js. This is in preparation for making lib/internal/assert.js a tiny module for use in Node.js built-ins so that we can use `assert()` without having to load the entire ~1200 line `assert` module.
For use in built-in modules that could benefit from `assert()` without having to load the entire module (unless an AssertionError actually occurs): lib/internal/assert.js.
Replace large 'assert' module with tiny 'internal/assert' module for many built-in uses.
Collaborator
Member Author
BridgeAR approved these changes Feb 6, 2019
| | ||
| assert.throws(() => { internalAssert(false); }, assert.AssertionError); | ||
| assert.throws(() => { internalAssert(false, 'fhqwhgads'); }, | ||
| { code: 'ERR_ASSERTION', message: 'fhqwhgads' }); |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hint: it is possible to check for the name field as well. That is a good alternative to checking for instanceof assert.AssertionError above (but it's off course not the same strict check).
Member Author
| Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/20616/ |
JungMinu approved these changes Feb 7, 2019
Member Author
| Landed in 7182aca...62942e9 |
Trott added a commit to Trott/io.js that referenced this pull request Feb 8, 2019
Move lib/internal/assert.js to lib/internal/assert/assertion_error.js. This is in preparation for making lib/internal/assert.js a tiny module for use in Node.js built-ins so that we can use `assert()` without having to load the entire ~1200 line `assert` module. PR-URL: nodejs#25956 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Trott added a commit to Trott/io.js that referenced this pull request Feb 8, 2019
For use in built-in modules that could benefit from `assert()` without having to load the entire module (unless an AssertionError actually occurs): lib/internal/assert.js. PR-URL: nodejs#25956 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Trott added a commit to Trott/io.js that referenced this pull request Feb 8, 2019
Replace large 'assert' module with tiny 'internal/assert' module for many built-in uses. PR-URL: nodejs#25956 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
addaleax pushed a commit that referenced this pull request Feb 8, 2019
Move lib/internal/assert.js to lib/internal/assert/assertion_error.js. This is in preparation for making lib/internal/assert.js a tiny module for use in Node.js built-ins so that we can use `assert()` without having to load the entire ~1200 line `assert` module. PR-URL: #25956 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
addaleax pushed a commit that referenced this pull request Feb 8, 2019
For use in built-in modules that could benefit from `assert()` without having to load the entire module (unless an AssertionError actually occurs): lib/internal/assert.js. PR-URL: #25956 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
targos pushed a commit that referenced this pull request Feb 10, 2019
Replace large 'assert' module with tiny 'internal/assert' module for many built-in uses. PR-URL: #25956 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Merged
This was referenced Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. lib / src Issues and PRs related to general changes in the lib or src directory.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
First commit:
Second commit:
Third commit:
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes