diff options
| author | 2023-08-10 13:09:03 -0700 | |
|---|---|---|
| committer | 2023-08-10 13:09:03 -0700 | |
| commit | 74f9fabd018e09e10ed8e8a8b82035f1e19c2162 (patch) | |
| tree | 6219a6a79ce9ef958c3391b7c58a21deeb1f4b39 /test/js/node | |
| parent | 8d207925d7f74c0ba1f63569f094504d42eebaf3 (diff) | |
| download | bun-74f9fabd018e09e10ed8e8a8b82035f1e19c2162.tar.gz bun-74f9fabd018e09e10ed8e8a8b82035f1e19c2162.tar.zst bun-74f9fabd018e09e10ed8e8a8b82035f1e19c2162.zip | |
add util.formatWithOptions (#4090)
* Add formatWithOptions
* tests and tweaks
* adjust
---------
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Diffstat (limited to 'test/js/node')
| -rw-r--r-- | test/js/node/util/util.test.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/js/node/util/util.test.js b/test/js/node/util/util.test.js index 741b27d19..df995955a 100644 --- a/test/js/node/util/util.test.js +++ b/test/js/node/util/util.test.js @@ -315,4 +315,14 @@ describe("util", () => { expect(util.TextDecoder === globalThis.TextDecoder).toBe(true); }); }); + + it("format", () => { + expect(util.format("%s:%s", "foo")).toBe("foo:%s"); + }); + it("formatWithOptions", () => { + expect(util.formatWithOptions({ colors: true }, "%s:%s", "foo")).toBe("foo:%s"); + expect(util.formatWithOptions({ colors: true }, "wow(%o)", { obj: true })).toBe( + "wow({ obj: \u001B[33mtrue\u001B[39m })", + ); + }); }); |
