src: iterate on import attributes array correctly · nodejs/node@b2b4132 · GitHub
Skip to content

Commit b2b4132

Browse files
targosUlisesGascon
authored andcommitted
src: iterate on import attributes array correctly
The array's length is supposed to be a multiple of two for dynamic import callbacks. Fixes: #50700 PR-URL: #50703 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 21ab3c0 commit b2b4132

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

src/module_wrap.cc

Lines changed: 8 additions & 4 deletions

test/es-module/test-esm-import-attributes-errors.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ async function test() {
2626
{ code: 'ERR_IMPORT_ASSERTION_TYPE_FAILED' }
2727
);
2828

29+
await rejects(
30+
import(jsModuleDataUrl, { with: { type: 'json', other: 'unsupported' } }),
31+
{ code: 'ERR_IMPORT_ASSERTION_TYPE_FAILED' }
32+
);
33+
2934
await rejects(
3035
import(jsModuleDataUrl, { with: { type: 'unsupported' } }),
3136
{ code: 'ERR_IMPORT_ASSERTION_TYPE_UNSUPPORTED' }

test/es-module/test-esm-import-attributes-errors.mjs

Lines changed: 5 additions & 0 deletions

0 commit comments

Comments
 (0)