Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create and export ES module along side umd bundle #151

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
coverage/
lib/sinon-chai.js
6 changes: 5 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
"es6": false
},
"parserOptions": {
"ecmaVersion": 5
"ecmaVersion": 2015,
"sourceType": "module",
"ecmaFeatures": {
"modules": true
}
},
"rules": {
// Possible errors
Expand Down
2 changes: 1 addition & 1 deletion .mocharc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use strict";

module.exports = {
require: ["./test/common"]
require: ["./test/setup.mjs"]
};
25 changes: 3 additions & 22 deletions lib/sinon-chai.js → lib/sinon-chai.mjs
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
"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 <script> tag): plug in to global chai instance directly.
/* global chai: false */
chai.use(sinonChai);
}
}(function (chai, utils) {

export default function (chai, utils) {
var slice = Array.prototype.slice;

function isSpy(putativeSpy) {
Expand Down Expand Up @@ -146,4 +127,4 @@
sinonMethod("calledWithMatch", "been called with arguments matching %*", "%D");
sinonMethod("returned", "returned %1");
exceptionalSinonMethod("thrown", "threw", "thrown %1");
}));
};
Loading