From 00779e16a657c9717aba360e6dd8909653e3df9e Mon Sep 17 00:00:00 2001 From: Justin Searls Date: Mon, 11 Jan 2016 16:32:15 -0500 Subject: [PATCH] 2.6.4 --- dist/jasmine-given.js | 6 +++--- dist/jasmine-given.min.js | 5 +++++ package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 dist/jasmine-given.min.js diff --git a/dist/jasmine-given.js b/dist/jasmine-given.js index a1c911e..51d7de7 100644 --- a/dist/jasmine-given.js +++ b/dist/jasmine-given.js @@ -1,4 +1,4 @@ -/* jasmine-given - 2.6.3 +/* jasmine-given - 2.6.4 * Adds a Given-When-Then DSL to jasmine as an alternative style for specs * https://github.com/searls/jasmine-given */ @@ -142,11 +142,11 @@ mostRecentlyUsed = root.subsequentThen; mostRecentExpectations = expectations = [expectationFunction]; mostRecentStacks = stacks = [errorWithRemovedLines("failed expectation", 3)]; - itFunction("then " + (label != null ? label : stringifyExpectation(expectations)), doneWrapperFor(expectationFunction, function(jasmineDone) { + itFunction("then " + (label != null ? label : stringifyExpectation(expectations)), function(jasmineDone) { var userCommands; userCommands = [].concat(whenList, invariantList, wrapAsExpectations(expectations, stacks)); return new Waterfall(userCommands, jasmineDone).flow(); - })); + }); return { Then: subsequentThen, And: subsequentThen diff --git a/dist/jasmine-given.min.js b/dist/jasmine-given.min.js new file mode 100644 index 0000000..2d5e95c --- /dev/null +++ b/dist/jasmine-given.min.js @@ -0,0 +1,5 @@ +/* jasmine-given - 2.6.4 + * Adds a Given-When-Then DSL to jasmine as an alternative style for specs + * https://github.com/searls/jasmine-given + */ +(function(){var a={}.hasOwnProperty,b=[].slice;!function(c){var d,e;if(null==c)return"undefined"!=typeof console&&null!==console?console.warn("jasmine was not found. Skipping jasmine-matcher-wrapper. Verify your script load order."):void 0;if(null==c.matcherWrapper)return c.matcherWrapper={wrap:function(b){var d,f,g;if(null==c.addMatchers)return b;g={};for(f in b)a.call(b,f)&&(d=b[f],g[f]=e(f,d));return g}},e=function(a,b){return function(){return{compare:d(b,!1),negativeCompare:d(b,!0)}}},d=function(a,c){return function(){var d,e,f,g,h,i;return d=arguments[0],g=2<=arguments.length?b.call(arguments,1):[],e={actual:d,isNot:c},h=a.apply(e,g),c&&(h=!h),h||(f=null!=(i=e.message)?i.apply(e,g):void 0),{pass:h,message:f}}}}(jasmine||getJasmineRequireObj())}).call(this),function(){var __slice=[].slice;!function(jasmine){var Waterfall,additionalInsightsForErrorMessage,apparentReferenceError,attemptedEquality,cloneArray,comparisonInsight,currentSpec,declareJasmineSpec,deepEqualsNotice,doneWrapperFor,errorWithRemovedLines,evalInContextOfSpec,finalStatementFrom,getBlock,invariantList,mostRecentExpectations,mostRecentStacks,mostRecentlyUsed,o,root,stringifyExpectation,wasComparison,whenList,wrapAsExpectations;return mostRecentlyUsed=null,root=(1,eval)("this"),currentSpec=null,beforeEach(function(){return currentSpec=this}),root.Given=function(){return mostRecentlyUsed=root.Given,beforeEach(getBlock(arguments))},whenList=[],root.When=function(){var a;return mostRecentlyUsed=root.When,a=getBlock(arguments),beforeEach(function(){return whenList.push(a)}),afterEach(function(){return whenList.pop()})},invariantList=[],root.Invariant=function(){var a;return mostRecentlyUsed=root.Invariant,a=getBlock(arguments),beforeEach(function(){return invariantList.push(a)}),afterEach(function(){return invariantList.pop()})},getBlock=function(a){var b,c;return c=o(a).firstThat(function(a){return o(a).isFunction()}),b=o(a).firstThat(function(a){return o(a).isString()}),doneWrapperFor(c,function(a){var d,e;if(d=currentSpec,e=c.call(d,a),b){if(d[b])throw new Error("Unfortunately, the variable '"+b+"' is already assigned to: "+d[b]);return d[b]=e}})},mostRecentExpectations=null,mostRecentStacks=null,declareJasmineSpec=function(a,b){var c,d,e,f;return null==b&&(b=it),e=o(a).firstThat(function(a){return o(a).isString()}),c=o(a).firstThat(function(a){return o(a).isFunction()}),mostRecentlyUsed=root.subsequentThen,mostRecentExpectations=d=[c],mostRecentStacks=f=[errorWithRemovedLines("failed expectation",3)],b("then "+(null!=e?e:stringifyExpectation(d)),function(a){var b;return b=[].concat(whenList,invariantList,wrapAsExpectations(d,f)),new Waterfall(b,a).flow()}),{Then:subsequentThen,And:subsequentThen}},wrapAsExpectations=function(a,b){var c,d,e,f,g;for(g=[],d=e=0,f=a.length;f>e;d=++e)c=a[d],g.push(function(a,c){return doneWrapperFor(a,function(d){return expect(a).not.toHaveReturnedFalseFromThen(currentSpec,c+1,b[c],d)})}(c,d));return g},doneWrapperFor=function(a,b){return 0===a.length?function(){return b()}:function(a){return b(a)}},root.Then=function(){return declareJasmineSpec(arguments)},root.Then.only=function(){return declareJasmineSpec(arguments,it.only)},root.subsequentThen=function(a){return mostRecentExpectations.push(a),mostRecentStacks.push(errorWithRemovedLines("failed expectation",3)),this},errorWithRemovedLines=function(a,b){var c,d,e,f;return(e=new Error(a).stack)?(f=e.split("\n"),c=f[0],d=2<=f.length?__slice.call(f,1):[],""+c+"\n"+d.slice(b).join("\n")):void 0},mostRecentlyUsed=root.Given,root.And=function(){return mostRecentlyUsed.apply(this,jasmine.util.argsToArray(arguments))},o=function(a){return{isFunction:function(){return"[object Function]"===Object.prototype.toString.call(a)},isString:function(){return"[object String]"===Object.prototype.toString.call(a)},firstThat:function(b){var c;for(c=0;c0?a(function(){return b.flow()}):(a(),this.flow()))},a}(),cloneArray=function(a){return a.slice(0)},jasmine._given={matchers:{toHaveReturnedFalseFromThen:function(a,b,c,d){var e,f,g;g=!1,f=void 0;try{g=this.actual.call(a,d)}catch(h){e=h,f=e}return this.message=function(){var a,d;return d=stringifyExpectation(this.actual),a="Then clause"+(b>1?" #"+b:"")+" `"+d+"` failed by ",a+=f?"throwing: "+f.toString():"returning false",a+=additionalInsightsForErrorMessage(d),null!=c&&(a+="\n\n"+c),a},g===!1}},__Waterfall__:Waterfall},stringifyExpectation=function(a){var b;return b=a.toString().replace(/\n/g,"").match(/function\s?\(.*\)\s?{\s*(return\s+)?(.*?)(;)?\s*}/i),b&&b.length>=3?b[2].replace(/\s+/g," "):""},additionalInsightsForErrorMessage=function(a){var b,c;return c=finalStatementFrom(a),(b=wasComparison(c))?comparisonInsight(c,b):""},finalStatementFrom=function(a){var b;return(b=a.match(/.*return (.*)/))?b[b.length-1]:a},wasComparison=function(a){var b,c,d,e,f;return(c=a.match(/(.*) (===|!==|==|!=|>|>=|<|<=) (.*)/))?(f=c[0],d=c[1],b=c[2],e=c[3],{left:d,comparator:b,right:e}):void 0},comparisonInsight=function(a,b){var c,d,e;return c=evalInContextOfSpec(b.left),e=evalInContextOfSpec(b.right),apparentReferenceError(c)&&apparentReferenceError(e)?"":(d="\n\nThis comparison was detected:\n "+a+"\n "+c+" "+b.comparator+" "+e,attemptedEquality(c,e,b.comparator)&&(d+="\n\n"+deepEqualsNotice(b.left,b.right)),d)},apparentReferenceError=function(a){return/^'}},attemptedEquality=function(a,b,c){var d;return"=="!==c&&"==="!==c?!1:null!=(null!=(d=jasmine.matchersUtil)?d.equals:void 0)?jasmine.matchersUtil.equals(a,b):jasmine.getEnv().equals_(a,b)},deepEqualsNotice=function(a,b){return"However, these items are deeply equal! Try an expectation like this instead:\n expect("+a+").toEqual("+b+")"},beforeEach(function(){return null!=jasmine.addMatchers?jasmine.addMatchers(jasmine.matcherWrapper.wrap(jasmine._given.matchers)):this.addMatchers(jasmine._given.matchers)})}(jasmine)}.call(this); \ No newline at end of file diff --git a/package.json b/package.json index c7e35f0..0f0a487 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jasmine-given", - "version": "2.6.3", + "version": "2.6.4", "description": "Adds a Given-When-Then DSL to jasmine as an alternative style for specs", "homepage": "https://github.com/searls/jasmine-given", "author": {