From 2a1558e4d6fc2e7abbb9a6f4abc3cc4bb2d49c59 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Wed, 22 Feb 2023 19:07:27 -0800 Subject: [breaking] Return Node.js `Timeout` objects in `setTimeout`, `setInterval`, and `setImmediate` Fixes #2129 #880 --- test/bun.js/inspect.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/bun.js/inspect.test.js') diff --git a/test/bun.js/inspect.test.js b/test/bun.js/inspect.test.js index 229f80548..243f23cdc 100644 --- a/test/bun.js/inspect.test.js +++ b/test/bun.js/inspect.test.js @@ -1,5 +1,14 @@ import { it, expect, describe } from "bun:test"; +it("Timeout", () => { + const id = setTimeout(() => {}, 0); + expect(Bun.inspect(id)).toBe(`Timeout (#${+id})`); + + const id2 = setInterval(() => {}, 1); + id2.unref(); + expect(Bun.inspect(id2)).toBe(`Timeout (#${+id2}, repeats)`); +}); + it("when prototype defines the same property, don't print the same property twice", () => { var base = { foo: "123", -- cgit v1.2.3