From 7341f93cd9158ed3c13f12f12c4d22a30b938c87 Mon Sep 17 00:00:00 2001 From: Robin Bisping Date: Mon, 13 May 2024 14:02:03 +0200 Subject: [PATCH] Convert package to esm (#161) --- .eslintrc.json | 3 +- .mocharc.js | 5 - .mocharc.json | 3 + lib/sinon-chai.js | 22 +- package-lock.json | 3402 ++++++++++++++++++++++++---------------- package.json | 9 +- test/callArguments.js | 7 +- test/callContext.js | 7 +- test/callCount.js | 7 +- test/callOrder.js | 7 +- test/callingWithNew.js | 7 +- test/common.js | 9 +- test/messages.js | 8 +- test/regressions.js | 6 +- test/returning.js | 7 +- test/throwing.js | 9 +- 16 files changed, 2069 insertions(+), 1449 deletions(-) delete mode 100644 .mocharc.js create mode 100644 .mocharc.json diff --git a/.eslintrc.json b/.eslintrc.json index f34ba89..99cd982 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,7 +6,8 @@ "es6": false }, "parserOptions": { - "ecmaVersion": 5 + "ecmaVersion": 6, + "sourceType": "module" }, "rules": { // Possible errors diff --git a/.mocharc.js b/.mocharc.js deleted file mode 100644 index b362cda..0000000 --- a/.mocharc.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -module.exports = { - require: ["./test/common"] -}; diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 0000000..c091e31 --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,3 @@ +{ + "require": "./test/common.js" +} diff --git a/lib/sinon-chai.js b/lib/sinon-chai.js index 194dc3a..6111840 100644 --- a/lib/sinon-chai.js +++ b/lib/sinon-chai.js @@ -1,24 +1,6 @@ -"use strict"; /* eslint-disable no-invalid-this */ -(function (sinonChai) { - // Module systems magic dance. - - /* istanbul ignore else */ - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { - // NodeJS - module.exports = sinonChai; - } else if (typeof define === "function" && define.amd) { - // AMD - define(function () { - return sinonChai; - }); - } else { - // Other environment (usually