Repository navigation
http2: handling errors while submitting settings #16083
Description
Activity
@trivikr In the JS codebase usually the
methodinhandle.methodis defined in the C++ land. In this case it is defined innode_http2.cc(), so the devtools won't be able to step into that, it's normal. If you do want to debug the C++ code, you can try attaching debuggers like gdb or lldb to your running process and set a breakpoint in that C++ method.Line 392 in e012229
void Http2Session::SubmitSettings(const FunctionCallbackInfo<Value>& args) { I will close this since this is not a bug, but feel free to discuss or ask questions in this thread.
- addedquestionIssues asking questions about Node.js.Issues asking questions about Node.js.
on Oct 8, 2017 Thanks @joyeecheung
Is there some example I can refer to check how C++ methods are mocked while testing in Javascript?@trivikr Sorry, I am not sure if I am following what "how C++ methods are mocked" means. If you want to know how the C++ glue code works, taking a look at the v8 Embedder's Guide would help
Hi @joyeecheung, while writing unit tests in Javascript we sometimes mock functions as we've to test particular file and not it's dependencies.
I came across a code which mocks C++ methods in Javascript at
node/test/parallel/test-http2-priority-errors.js
Lines 52 to 53 in b3a8bf3
// mock submitPriority because we only care about testing error handling Http2Session.prototype.submitPriority = () => currentError.ngError; @trivikr I don't work with HTTP2 tests but I think you can just do something like what the code that you have posted does, and mock
submitSettingto return values that can get you into the branches you want to cover.Yes, I'm using the following line for mocking submitSettings
Http2Session.prototype.submitSettings = () => constants.NGHTTP2_ERR_NOMEM;
As part of improving http2 test coverage in #14985, I was trying to unit test the following code in submitSettings()
node/lib/internal/http2/core.js
Lines 563 to 574 in e012229
While debugging, I'm not able to step into

handle.submitSettings()to check how the value ofretis computedI don't see method
submitSettingsforhandlein the call stack.This appears to be an issue. Am I missing something? I'm testing on node master branch.