aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-finalization-group-error.js
diff options
context:
space:
mode:
authorGus Caplan <me@gus.host>2019-10-11 15:53:41 -0700
committerGus Caplan <me@gus.host>2019-10-13 15:45:36 -0700
commit545f7282d126ee43cf9cfeb66c83d0cbd2c60614 (patch)
tree8cd69c849fb60a6a84af8894c16f02c7723a7dcf /test/parallel/test-finalization-group-error.js
parentea3d5ff785e5f7b327942f9b47b3bd958e77c51f (diff)
downloadandroid-node-v8-545f7282d126ee43cf9cfeb66c83d0cbd2c60614.tar.gz
android-node-v8-545f7282d126ee43cf9cfeb66c83d0cbd2c60614.tar.bz2
android-node-v8-545f7282d126ee43cf9cfeb66c83d0cbd2c60614.zip
src: implement v8 host weakref hooks
PR-URL: https://github.com/nodejs/node/pull/29874 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'test/parallel/test-finalization-group-error.js')
-rw-r--r--test/parallel/test-finalization-group-error.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/parallel/test-finalization-group-error.js b/test/parallel/test-finalization-group-error.js
new file mode 100644
index 0000000000..0754370f2d
--- /dev/null
+++ b/test/parallel/test-finalization-group-error.js
@@ -0,0 +1,23 @@
+'use strict';
+
+// Flags: --expose-gc --harmony-weak-refs
+
+const common = require('../common');
+const assert = require('assert');
+
+const g = new globalThis.FinalizationGroup(common.mustCallAtLeast(() => {
+ throw new Error('test');
+}, 1));
+g.register({}, 42);
+
+setTimeout(() => {
+ globalThis.gc();
+ assert.throws(() => {
+ g.cleanupSome();
+ }, {
+ name: 'Error',
+ message: 'test',
+ });
+}, 200);
+
+process.on('uncaughtException', common.mustCall());