diff --git a/lib/sinon/util/core/format.js b/lib/sinon/util/core/format.js deleted file mode 100644 index 033c145d7..000000000 --- a/lib/sinon/util/core/format.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -var inspect = require("util").inspect; -var customFormatter; - -function format() { - if (customFormatter) { - return customFormatter.apply(null, arguments); - } - - return inspect.apply(inspect, arguments); -} - -format.setFormatter = function (aCustomFormatter) { - if (typeof aCustomFormatter !== "function") { - throw new Error("format.setFormatter must be called with a function"); - } - - customFormatter = aCustomFormatter; -}; - -module.exports = format; diff --git a/test/util/core/format-test.js b/test/util/core/format-test.js deleted file mode 100644 index 6eaed189c..000000000 --- a/test/util/core/format-test.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -var referee = require("@sinonjs/referee"); -var sinon = require("../../../lib/sinon"); -var format = require("../../../lib/sinon/util/core/format"); -var assert = referee.assert; - -describe("util/core/format", function () { - describe("format.setFormatter", function () { - it("sets custom formatter", function () { - format.setFormatter(function () { - return "formatted"; - }); - assert.equals(format("Hey"), "formatted"); - }); - - it("throws if custom formatter is not a function", function () { - assert.exception( - function () { - format.setFormatter("foo"); - }, - { - message: - "format.setFormatter must be called with a function", - } - ); - }); - - it("exposes method on sinon", function () { - assert.equals(sinon.setFormatter, format.setFormatter); - }); - }); -});