Skip to content

Commit e09951d

Browse files
committed
v8: add a js class for Serializer/Dserializer
Calling Serializer/Deserlizer without new crashes node. Adding a js class which just inherits cpp bindings. Added refression tests. Fixes: #13326
1 parent 90c50a6 commit e09951d

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

test/parallel/test-v8-serdes.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,19 @@ const objects = [
133133
}
134134

135135
{
136-
try {
137-
v8.Serializer();
138-
} catch (e) {
139-
const m = "Class constructor Serializer cannot be invoked without 'new'";
140-
assert.strictEqual(e.message, m);
141-
}
142-
143-
try {
144-
v8.Deserializer();
145-
} catch (e) {
146-
const m = "Class constructor Deserializer cannot be invoked without 'new'";
147-
assert.strictEqual(e.message, m);
148-
}
136+
assert.throws(
137+
() => {
138+
v8.Serializer();
139+
},
140+
Error,
141+
"Class constructor Serializer cannot be invoked without 'new'"
142+
);
143+
144+
assert.throws(
145+
() => {
146+
v8.Derializer();
147+
},
148+
Error,
149+
"Class constructor Deserializer cannot be invoked without 'new'"
150+
);
149151
}

0 commit comments

Comments
 (0)