test: increase coverage for ModuleMap#16045
Conversation
|
Ping @bmeck |
|
Could be a duplicate. merging the two should be fine. |
|
@bmeck Could always land now as separate files and anyone who feels strongly about it can merge code in a subsequent PR. FWIW, I don't mind a lot of similar code in tests if it makes each test more comprehensible as a standalone entity. (For anyone generally interested in why "DRY" may not be desirable in tests, see e.g. https://stackoverflow.com/a/11837973/436641) |
|
@Trott I like it. |
|
Yep, I'd definitely lean toward clarity of tests over conciseness. |
jasnell
left a comment
There was a problem hiding this comment.
Very close. One change that I can see.
There was a problem hiding this comment.
These should use...
common.expectsError(
() => moduleMap.get(1),
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "url" argument must be of type string'
}
);
There was a problem hiding this comment.
Hi @jasnell I've update the tests to use common.expectsError as suggested
Thanks!
There was a problem hiding this comment.
Please make this the first require() statement (just move it before require('url')).
|
@jasnell I think you forgot to update your LG. @robtpaton it would be nice if you could rebase to remove the merge commit. |
79e3110 to
65a4ac2
Compare
|
@BridgeAR I've rebased to remove the merge commit Thanks! |
There was a problem hiding this comment.
CI failed across all platforms:
not ok 2040 es-module/test-esm-loader-modulemap
---
duration_ms: 0.72
severity: fail
stack: |-
internal/loader/ModuleJob.js:18
this.modulePromise = this.moduleProvider(url);
^
TypeError: this.moduleProvider is not a function
at new ModuleJob (internal/loader/ModuleJob.js:18:31)
at Object.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/es-module/test-esm-loader-modulemap.js:19:19)
at Module._compile (module.js:616:30)
at Object.Module._extensions..js (module.js:627:10)
at Module.load (module.js:535:32)
at tryModuleLoad (module.js:478:12)
at Function.Module._load (module.js:470:3)
at Function.Module.runMain (module.js:657:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:613:3
...
new ModuleJob needs a moduleProvider as the third argument.
There was a problem hiding this comment.
I think you can just use a function that returns a never-resolving Promise for this
|
ping @robtpaton - can you please address @joyeecheung / @addaleax 's comments? |
65a4ac2 to
9888535
Compare
|
Rebased, fixed the issue, force-pushed. Hope that's OK, @robtpaton! PTAL, especially @joyeecheung. |
|
Some build-specific (that is: unrelated to this PR) failures on that last CI. Here's another one: |
Add test for ModuleMap set with ModuleJob but bad url. PR-URL: nodejs#16045 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
|
Landed in d1a9c02. Thanks for the contribution! 🎉 |
Add test for ModuleMap set with ModuleJob but bad url. PR-URL: nodejs/node#16045 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Add test for ModuleMap set with ModuleJob but bad url. PR-URL: nodejs/node#16045 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
|
Thanks for getting this over the line @Trott |
Add test for ModuleMap set with ModuleJob but bad url. PR-URL: nodejs#16045 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Add test for ModuleMap set with ModuleJob but bad url. PR-URL: #16045 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Add test for ModuleMap set with ModuleJob but bad url. PR-URL: nodejs/node#16045 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Checklist
Affected core subsystem(s)
test