lib: AssertionError moved to internal/error#12906
lib: AssertionError moved to internal/error#12906fhalde wants to merge 2 commits intonodejs:masterfrom
Conversation
|
There is one test case which I've been trying to resolve but have been out of luck. Looks like the test suite regex matches the exception being thrown. Since |
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
Could we use const fail = require('assert').fail instead of inline codes?
lib/internal/errors.js
Outdated
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
I don't think we're going to need the factory method in this case. The other ones are there just to reduce code duplication. Just define the class and export it directly.
There was a problem hiding this comment.
Cool. Also there is a test case that depends on how the AssertionError object was created (regex matching). How do I fix that? Earlier AssertionError object were created like throw new AssertionError, but now in assert.js, I do it like this throw new error.AssertionError.
There was a problem hiding this comment.
I can very well store the constructor reference in a variable named like the class, but that would be a hack!
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
This should fail linting... this needs a 2 character space indent
There was a problem hiding this comment.
how can I just run the linter on my code?
lib/internal/errors.js
Outdated
There was a problem hiding this comment.
just AssertionError, should suffice (it does not need the additional : AssertionError bit)
AssertionError class is moved to interna/error in reference to the TODO in assert.js. This was suggested to get rid of the cyclic dependency between assert.js and internal/error.js
|
@jasnell done & done |
|
Before I pushed my changes. There were 4 test cases that were failing. After my changes there are 5 test cases failing. I know the reason why the 5th one is failing. I'm just not sure where to do the changes!
|
|
@fhalde I think you might be able to fix the CI by updating the third line in |
| operator = '!='; | ||
| throw new AssertionError({ | ||
| const errors = lazyErrors(); | ||
| throw new errors.AssertionError({ |
There was a problem hiding this comment.
Nit: This is anyway exported. Why not just throw new assert. AssertionError({...});
There was a problem hiding this comment.
If I remember, there was a problem caused by cyclic dependency. Something wasn't initialized causing few test cases to fail. Let me check it again!
|
If everything looks good, i'll squash the commits. I guess GitHub has the feature of squashing the PR?? |
|
The commits can be squashed by whomever lands the PR |
AssertionError class is moved to interna/error in reference to the TODO in assert.js. This was suggested to get rid of the cyclic dependency between assert.js and internal/error.js PR-URL: #12906 Reviewed-By: James M Snell <jasnell@gmail.com>
|
Landed in 425aba4 |
AssertionError class is moved to interna/error in reference to the TODO in assert.js. This was suggested to get rid of the cyclic dependency between assert.js and internal/error.js PR-URL: #12906 Reviewed-By: James M Snell <jasnell@gmail.com>
AssertionError class is moved to interna/error in reference to the TODO in assert.js. This was suggested to get rid of the cyclic dependency between assert.js and internal/error.js PR-URL: #12906 Reviewed-By: James M Snell <jasnell@gmail.com>
AssertionError class is moved to interna/error in reference to the TODO in assert.js. This was suggested to get rid of the cyclic dependency between assert.js and internal/error.js PR-URL: #12906 Reviewed-By: James M Snell <jasnell@gmail.com>
|
Opting to not land this on v6.x... lmk if we should backport |
AssertionError class is moved to internal/error
in reference to the TODO in assert.js. This was
suggested to get rid of the cyclic dependency
between assert.js and internal/error.js
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
assert