diff options
author | Gus Caplan <me@gus.host> | 2022-04-22 05:08:16 +0300 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2022-04-28 07:57:23 +0300 |
commit | 0e16120d0dcaa0eb6e075325d077480caf8c3e7a (patch) | |
tree | 5b17bcdb88066dda528f567a50ec63645fad291c /test | |
parent | 494650c09f77c4f8bed6270cdec37601f46fc7c0 (diff) |
errors,vm: update error and use cause
PR-URL: https://github.com/nodejs/node/pull/42820
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-vm-module-errors.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/parallel/test-vm-module-errors.js b/test/parallel/test-vm-module-errors.js index 888250cef84..bec8258a414 100644 --- a/test/parallel/test-vm-module-errors.js +++ b/test/parallel/test-vm-module-errors.js @@ -139,20 +139,25 @@ async function checkLinking() { code: 'ERR_VM_MODULE_DIFFERENT_CONTEXT' }); + const error = new Error(); await assert.rejects(async () => { - const erroredModule = new SourceTextModule('import "foo";'); + globalThis.error = error; + const erroredModule = new SourceTextModule('throw error;'); + await erroredModule.link(common.mustNotCall()); try { - await erroredModule.link(common.mustCall(() => ({}))); + await erroredModule.evaluate(); } catch { // ignored - } finally { - assert.strictEqual(erroredModule.status, 'errored'); } + delete globalThis.error; + + assert.strictEqual(erroredModule.status, 'errored'); const rootModule = new SourceTextModule('import "errored";'); await rootModule.link(common.mustCall(() => erroredModule)); }, { - code: 'ERR_VM_MODULE_LINKING_ERRORED' + code: 'ERR_VM_MODULE_LINK_FAILURE', + cause: error, }); } |