diff --git a/.jscsrc b/.jscsrc new file mode 100644 index 0000000..fa79705 --- /dev/null +++ b/.jscsrc @@ -0,0 +1,73 @@ +{ + "esnext": true, + "requireCurlyBraces": [ + "if", + "else", + "for", + "while", + "do", + "try", + "catch" + ], + "requireOperatorBeforeLineBreak": true, + "requireCamelCaseOrUpperCaseIdentifiers": true, + "maximumLineLength": { + "value": 90, + "allowComments": true, + "allowRegex": true + }, + "validateIndentation": 4, + "validateQuoteMarks": "'", + + "disallowMultipleLineStrings": true, + "disallowMixedSpacesAndTabs": true, + "disallowTrailingWhitespace": true, + "disallowSpaceAfterPrefixUnaryOperators": true, + "disallowMultipleVarDecl": true, + + "requireSpaceAfterKeywords": [ + "if", + "else", + "for", + "while", + "do", + "switch", + "return", + "try", + "catch" + ], + "requireSpaceBeforeBinaryOperators": true, + "requireSpaceAfterBinaryOperators": true, + "requireSpacesInConditionalExpression": true, + "requireLineFeedAtFileEnd": true, + "disallowSpacesInsideObjectBrackets": "all", + "disallowSpacesInsideArrayBrackets": "all", + "disallowSpacesInsideParentheses": true, + + "disallowMultipleLineBreaks": true, + + "requireParenthesesAroundIIFE": true, + + "disallowKeywords": ["with"], + + "requireSpacesInAnonymousFunctionExpression": { + "beforeOpeningRoundBrace": true, + "beforeOpeningCurlyBrace": true + }, + + "requireSpacesInNamedFunctionExpression": { + "beforeOpeningCurlyBrace": true + }, + + "disallowSpacesInNamedFunctionExpression": { + "beforeOpeningRoundBrace": true + }, + + "requireSpacesInFunctionDeclaration": { + "beforeOpeningCurlyBrace": true + }, + + "disallowSpacesInFunctionDeclaration": { + "beforeOpeningRoundBrace": true + } +} diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..8c84ab5 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,43 @@ +{ + "globals": { }, + "node": true, + "regexdash": true, + "browser": true, + "sub": true, + "curly": true, + "camelcase": true, + "eqeqeq": true, + "forin": true, + "newcap": true, + "immed": true, + "indent": false, + "latedef": "nofunc", + "noarg": true, + "plusplus": false, + "quotmark": "single", + "undef": true, + "unused": true, + "strict": false, + "trailing": false, + "maxparams": false, + "maxdepth": false, + "maxstatements": false, + "maxcomplexity": false, + "maxlen": 200, + "asi": false, + "boss": false, + "debug": true, + "eqnull": false, + "esnext": false, + "evil": false, + "funcscope": false, + "smarttabs": false, + "shadow": true, + "supernew": true, + "devel": true, + "node": true, + "white": false, + "laxbreak": true, + "validthis": true, + "esnext": true +} diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..a3ea253 --- /dev/null +++ b/.npmignore @@ -0,0 +1,4 @@ +ignore/ +.idea/ +*.sublime-project +*.sublime-workspace diff --git a/dist/chai-spies-tdd.js b/dist/chai-spies-tdd.js new file mode 100644 index 0000000..1bdc489 --- /dev/null +++ b/dist/chai-spies-tdd.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +exports['default'] = function (chai, utils) { + utils.addMethod(chai.assert, 'calledOnce', function (actual, expected, msg) { + new chai.Assertion(actual).to.have.been.called.once(msg); + }); + + utils.addMethod(chai.assert, 'notCalledOnce', function (actual, expected, msg) { + new chai.Assertion(actual).not.to.have.been.called.once(msg); + }); +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index d40ac78..0000000 --- a/index.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function(chai, utils) { - utils.addMethod(chai.assert, 'calledOnce', function(actual, expected, msg) { - new chai.Assertion(actual).to.have.been.called.once(msg); - }); - - utils.addMethod(chai.assert, 'notCalledOnce', function(actual, expected, msg) { - new chai.Assertion(actual).not.to.have.been.called.once(msg); - }); -} diff --git a/package.json b/package.json new file mode 100644 index 0000000..53978cb --- /dev/null +++ b/package.json @@ -0,0 +1,41 @@ +{ + "name": "chai-spies-tdd", + "version": "0.0.0", + "author": "Eryk Napierala", + "description": "TDD-style interface for chai-spies.", + "license": "MIT", + "homepage": "https://github.com/erykpiast/chai-spies-tdd", + "bugs": "https://github.com/erykpiast/chai-spies-tdd/issues", + "repository": { + "type": "git", + "url": "https://github.com/erykpiast/chai-spies-tdd" + }, + "keywords": [ + "cyclejs", + "streams", + "group" + ], + "main": "dist/chai-spies-tdd.js", + "peerDependencies": { + "chai-spies": ">=0.6" + }, + "devDependencies": { + "babel": "~5.2", + "jscs": "~1.12", + "jshint": "~2.7" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "jshint": "jshint src/", + "jscs": "jscs src/", + "precompile": "rm -rf dist/ && mkdir -p dist", + "compile": "babel -d dist/ src/", + "prepublish": "npm run compile", + "release": "npm run release-patch", + "release-patch": "git checkout master && npm run compile; git commit -a -m 'Build dist/'; npm version patch && git push origin master --tags && npm publish", + "release-minor": "git checkout master && npm run compile; git commit -a -m 'Build dist/'; npm version minor && git push origin master --tags && npm publish", + "release-major": "git checkout master && npm run compile; git commit -a -m 'Build dist/'; npm version major && git push origin master --tags && npm publish" + } +} diff --git a/src/chai-spies-tdd.js b/src/chai-spies-tdd.js new file mode 100644 index 0000000..52bb11a --- /dev/null +++ b/src/chai-spies-tdd.js @@ -0,0 +1,9 @@ +export default function (chai, utils) { + utils.addMethod(chai.assert, 'calledOnce', function (actual, expected, msg) { + new chai.Assertion(actual).to.have.been.called.once(msg); + }); + + utils.addMethod(chai.assert, 'notCalledOnce', function (actual, expected, msg) { + new chai.Assertion(actual).not.to.have.been.called.once(msg); + }); +}