Skip to content

Commit

Permalink
fix: handle breaking changes in Sinon 17.0.2
Browse files Browse the repository at this point in the history
Sinon 17.0.2 shipped with a breaking change for sinon-test (should have been
Sinon 18, really). By moving the removed file into this repo, all is good.
  • Loading branch information
fatso83 committed May 15, 2024
1 parent b083075 commit cd51649
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 90 deletions.
22 changes: 22 additions & 0 deletions lib/default-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use strict";

module.exports = {
injectInto: null,
injectIntoThis: true,
properties: [
"spy",
"stub",
"mock",
"clock",
"server",
"requests",
"fake",
"define",
"replace",
"replaceSetter",
"replaceGetter",
"createStubInstance",
],
useFakeTimers: true,
useFakeServer: true,
};
11 changes: 4 additions & 7 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
*/
"use strict";

var utils = require("./utils");
var getConfig = require("./get-config");
var slice = Array.prototype.slice;
const utils = require("./utils");
const getConfig = require("./get-config");
const defaultConfig = require("./default-config");
const slice = Array.prototype.slice;

function finish(sandbox, error, dontThrow) {
if (error) {
Expand Down Expand Up @@ -74,10 +75,6 @@ function configure(sinon, config) {

var sandboxFactory = sinon.createSandbox || sinon.sandbox.create;

var defaultConfig = Object.assign(
{ injectIntoThis: true },
sinon.defaultConfig
);
function callSandboxedFn(context, args, fn, handler) {
var internalConfig = getConfig(defaultConfig, config);
internalConfig.injectInto =
Expand Down
Loading

0 comments on commit cd51649

Please sign in to comment.