Skip to content

Commit 911d2d2

Browse files
committed
Add failing test for throwing scalars
1 parent cda7b24 commit 911d2d2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/same_window.comlink.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,21 @@ describe("Comlink in the same realm", function() {
147147
}
148148
});
149149

150+
it("can rethrow scalars", async function() {
151+
const thing = Comlink.wrap(this.port1);
152+
Comlink.expose(_ => {
153+
throw "oops";
154+
}, this.port2);
155+
try {
156+
await thing();
157+
throw "Should have thrown";
158+
} catch (err) {
159+
expect(err).to.not.eq("Should have thrown");
160+
expect(err).to.be("oops");
161+
expect(typeof err).to.be("string");
162+
}
163+
});
164+
150165
it("can work with parameterized functions", async function() {
151166
const thing = Comlink.wrap(this.port1);
152167
Comlink.expose((a, b) => a + b, this.port2);

0 commit comments

Comments
 (0)