diff --git a/test/parallel/test-vm-script-throw-in-tostring.js b/test/parallel/test-vm-script-throw-in-tostring.js new file mode 100644 index 00000000000000..20e7a75079b33c --- /dev/null +++ b/test/parallel/test-vm-script-throw-in-tostring.js @@ -0,0 +1,14 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +const vm = require('vm'); + +assert.throws(() => { + new vm.Script({ + toString() { + throw new Error(); + } + }); +}, Error);