diff --git a/lib/create-sinon-api.js b/lib/create-sinon-api.js index 24cd0f77a..8e9d1ca49 100644 --- a/lib/create-sinon-api.js +++ b/lib/create-sinon-api.js @@ -7,15 +7,17 @@ const fakeTimers = require("./sinon/util/fake-timers"); const Sandbox = require("./sinon/sandbox"); const stub = require("./sinon/stub"); const promise = require("./sinon/promise"); -const assert = require("node:assert"); +const nise = require("nise"); +const assert = require("assert"); /** * @param {object} opts injection point to override the default XHR lib in testing * @param {object} opts.sinonXhrLib * @returns {object} a configured sandbox */ -module.exports = function createApi({ sinonXhrLib }) { - assert(sinonXhrLib, "No XHR lib passed in"); +module.exports = function createApi(opts = { sinonXhrLib: nise }) { + assert(opts?.sinonXhrLib, "No XHR lib passed in"); + const { sinonXhrLib } = opts; const apiMethods = { createSandbox: createSandbox, diff --git a/lib/sinon.js b/lib/sinon.js index 271477b65..c9065a902 100644 --- a/lib/sinon.js +++ b/lib/sinon.js @@ -1,6 +1,5 @@ "use strict"; -const nise = require("nise"); const createApi = require("./create-sinon-api"); -module.exports = createApi({ sinonXhrLib: nise }); +module.exports = createApi();