Uh oh!
There was an error while loading. Please reload this page.
test: improve coverage of lib/internal/loader/ModuleMap.js - #16061
test: improve coverage of lib/internal/loader/ModuleMap.js#16061jphblais wants to merge 1 commit into
Conversation
@jphblais, hi. Thank you for contributions! It may be better to use new branches for different PRs, so that their commits are not duplicated and mixed. |
bmeck
left a comment
There was a problem hiding this comment.
LGTM, nit on comment is not blocking.
| // As long as the assertion of "job" argument is done after the assertion of | ||
| // "url" argument this test suite is ok. Tried to mock the "job" parameter, | ||
| // but I think it's useless, and was not simple to mock... |
There was a problem hiding this comment.
Can we remove the extra text, I think the first sentence is enough:
Tried to mock the "job" parameter, but I think it's useless, and was not simple to mock...
| assert.throws(() => moduleMap.has(1), errorReg); | ||
| assert.throws(() => moduleMap.has(() => {}), errorReg); |
There was a problem hiding this comment.
Nit: We don't really need to keep all of the assertions separated by empty lines, and we usually don't do it for single-line assertions. I think it mostly blows up the visual file size in this case.
BridgeAR
commented
Oct 9, 2017
CI has some failures that appear to be unrelated. smartos15-64smartos16-640,pi3-raspbian-jessieI will self-assign and land this unless there are objections based on these test results. |
| const moduleMap = new ModuleMap(); | ||
| assert.throws(() => moduleMap.get({}), errorReg); |
There was a problem hiding this comment.
Nit: we can put these in a loop to adhere to the DRY principle:
[{},[],true,1,()=>{}].forEach((element)=>{assert.throws(()=>moduleMap.get(element),errorReg);});There was a problem hiding this comment.
These should likely be made into...
common.expectsError(()=>moduleMap.get([]),{code: 'ERR_INVALID_ARG_TYPE',type: TypeError,message: /^The"url"argumentmustbeoftypestring/});etc
tniessen
commented
Oct 20, 2017
Seems like this needs to be rebased. |
Trott
commented
Oct 27, 2017
Obsoleted by #15924 from same author. |
Added tests to cover the exceptions "throw'ed" in ModuleMap class.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)