Comparing version 1.0.0-alpha.10 to 1.0.0-alpha.11
CHANGELOG | ||
v1.0.0-alpha.11 | ||
- `spy.returns` method added | ||
- Server start retry logic to handle port in use case. | ||
v1.0.0-alpha.10 | ||
@@ -4,0 +8,0 @@ - bundle size tests |
@@ -1,2 +0,2 @@ | ||
'use strict';var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&'function'==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj},_createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_globals=require('./utils/globals'),_localStorage=require('./utils/local-storage'),_localStorage2=_interopRequireDefault(_localStorage),_timestamp=require('./utils/timestamp'),_formatters=require('./utils/formatters'),_color=require('./utils/color'),_autobind=require('./utils/autobind'),_assert=require('../lib/utils/assert'),_assert2=_interopRequireDefault(_assert);Object.defineProperty(exports,'__esModule',{value:!0});function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}return Array.from(arr)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}var originalConsole={debug:_globals.isBrowser?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},DEFAULT_SETTINGS={enabled:!1,priority:0};function noop(){}var cache={};function getTableHeader(table){for(var key in table)for(var title in table[key])return title||'untitled';return'empty'}var Log=function(){function Log(){var _ref=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},id=_ref.id;_classCallCheck(this,Log),this.id=id,this.VERSION=_globals.VERSION,this._startTs=(0,_timestamp.getTimestamp)(),this._deltaTs=(0,_timestamp.getTimestamp)(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new _localStorage2.default('__probe-'+this.id+'__',DEFAULT_SETTINGS),this.userData={},this.timeStamp(this.id+' started'),(0,_autobind.autobind)(this),Object.seal(this)}var _NumberisFinite=Number.isFinite;return _createClass(Log,[{key:'isEnabled',value:function isEnabled(){return this._storage.config.enabled}},{key:'getPriority',value:function getPriority(){return this._storage.config.priority}},{key:'getLevel',value:function getLevel(){return this._storage.config.priority}},{key:'getTotal',value:function getTotal(){return+((0,_timestamp.getTimestamp)()-this._startTs).toPrecision(10)}},{key:'getDelta',value:function getDelta(){return+((0,_timestamp.getTimestamp)()-this._deltaTs).toPrecision(10)}},{key:'enable',value:function enable(){var enabled=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:enabled}),this}},{key:'setLevel',value:function setLevel(level){return this._storage.updateConfiguration({priority:level}),this}},{key:'warn',value:function warn(message){for(var _len=arguments.length,args=Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];return this._getLogFunction({message:message,args:args,method:originalConsole.warn,once:!0})}},{key:'error',value:function error(message){for(var _len2=arguments.length,args=Array(1<_len2?_len2-1:0),_key2=1;_key2<_len2;_key2++)args[_key2-1]=arguments[_key2];return this._getLogFunction({message:message,args:args,method:originalConsole.error})}},{key:'deprecated',value:function deprecated(oldUsage,newUsage){return this.warn('`'+oldUsage+'` is deprecated and will be removed in a later version. Use `'+newUsage+'` instead')}},{key:'removed',value:function removed(oldUsage,newUsage){return this.error('`'+oldUsage+'` has been removed. Use `'+newUsage+'` instead')}},{key:'probe',value:function probe(priority,message){for(var _len3=arguments.length,args=Array(2<_len3?_len3-2:0),_key3=2;_key3<_len3;_key3++)args[_key3-2]=arguments[_key3];return this._getLogFunction({priority:priority,message:message,args:args,method:originalConsole.log,time:!0})}},{key:'log',value:function log(priority,message){for(var _len4=arguments.length,args=Array(2<_len4?_len4-2:0),_key4=2;_key4<_len4;_key4++)args[_key4-2]=arguments[_key4];return this._getLogFunction({priority:priority,message:message,args:args,method:originalConsole.debug})}},{key:'info',value:function info(priority,message){for(var _len5=arguments.length,args=Array(2<_len5?_len5-2:0),_key5=2;_key5<_len5;_key5++)args[_key5-2]=arguments[_key5];return this._getLogFunction({priority:priority,message:message,args:args,method:console.info})}},{key:'once',value:function once(priority,message){for(var _len6=arguments.length,args=Array(2<_len6?_len6-2:0),_key6=2;_key6<_len6;_key6++)args[_key6-2]=arguments[_key6];return this._getLogFunction({priority:priority,message:message,args:args,method:originalConsole.debug||originalConsole.info,once:!0})}},{key:'table',value:function table(priority,_table,columns){if(_table){var tag=getTableHeader(_table);return this._getLogFunction({priority:priority,message:_table,args:columns&&[columns],tag:tag,method:console.table||noop})}return noop}},{key:'image',value:function image(_ref2){var priority=_ref2.priority,_image=_ref2.image,_ref2$message=_ref2.message,message=void 0===_ref2$message?'':_ref2$message,_ref2$scale=_ref2.scale,scale=void 0===_ref2$scale?1:_ref2$scale;if(priority>this.getPriority())return noop;if('undefined'==typeof window)return noop;if('string'==typeof _image){var img=new Image;img.onload=function(){return console.log(_formatters.formatImage.bind(null,img,message,scale))},img.src=_image}var element=_image.nodeName||'';if('img'===element.toLowerCase()&&console.log((0,_formatters.formatImage)(_image,message,scale)),'canvas'===element.toLowerCase()){var _img=new Image;_img.onload=function(){return console.log(_formatters.formatImage.bind(null,_img,message,scale))},_img.src=_image.toDataURL()}return noop}},{key:'time',value:function time(priority,message){return this._getLogFunction({priority:priority,message:message,method:console.time?console.time:console.info})}},{key:'timeEnd',value:function timeEnd(priority,message){return this._getLogFunction({priority:priority,message:message,method:console.timeEnd?console.timeEnd:console.info})}},{key:'timeStamp',value:function timeStamp(priority,message){return this._getLogFunction({priority:priority,message:message,method:console.timeStamp||noop})}},{key:'group',value:function group(priority,message){var opts=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};opts=this._parseArguments({priority:priority,message:message,opts:opts});var _opts=opts,collapsed=_opts.collapsed;return this._getLogFunction({priority:priority,message:message,opts:opts,method:(collapsed?console.groupCollapsed:console.group)||console.info})}},{key:'groupCollapsed',value:function groupCollapsed(priority,message){var opts=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return this.group(priority,message,Object.assign({},opts,{collapsed:!0}))}},{key:'groupEnd',value:function groupEnd(priority){return this._getLogFunction({priority:priority,message:'',method:console.groupEnd||noop})}},{key:'withGroup',value:function withGroup(priority,message,func){var opts=this._parseArguments({priority:priority,message:message});this.group(opts);try{func()}finally{this.groupEnd(opts.message)}}},{key:'trace',value:function trace(){console.trace&&console.trace()}},{key:'_shouldLog',value:function _shouldLog(priority){return(0,_assert2.default)(_NumberisFinite(priority),'log priority must be a number'),0===priority||this.isEnabled()&&this.getPriority()>=priority}},{key:'_getElapsedTime',value:function _getElapsedTime(){var total=this.getTotal(),delta=this.getDelta();return this._deltaTs=(0,_timestamp.getTimestamp)(),{total:total,delta:delta}}},{key:'_getLogFunction',value:function _getLogFunction(opts){var _opts2=opts,method=_opts2.method;if(opts=this._parseArguments(opts),(0,_assert2.default)(method),this._shouldLog(opts.priority)){var _opts3=opts,message=_opts3.message,tag=opts.tag||opts.message;if(opts.once)if(!cache[tag])cache[tag]=(0,_timestamp.getTimestamp)();else return noop;return message=this._decorateMessage(message,opts),method.bind.apply(method,[console,message].concat(_toConsumableArray(opts.args)))}return noop}},{key:'_parseArguments',value:function _parseArguments(options){var priority=options.priority,message=options.message,_options$args=options.args,args=void 0===_options$args?[]:_options$args,_options$opts=options.opts,opts=void 0===_options$opts?{}:_options$opts,normOpts=this._normalizeArguments({priority:priority,message:message,args:args}),_getElapsedTime2=this._getElapsedTime(),delta=_getElapsedTime2.delta,total=_getElapsedTime2.total;return Object.assign(options,normOpts,opts,{delta:delta,total:total})}},{key:'_normalizeArguments',value:function _normalizeArguments(_ref3){var priority=_ref3.priority,message=_ref3.message,_ref3$args=_ref3.args,args=void 0===_ref3$args?[]:_ref3$args,newOpts=null;switch('undefined'==typeof priority?'undefined':_typeof(priority)){case'number':(0,_assert2.default)(0<=priority),newOpts={priority:priority,message:message,args:args};break;case'string':case'function':void 0!==message&&args.unshift(message),newOpts={priority:0,message:priority,args:args};break;case'object':newOpts=Object.assign({priority:0,message:message,args:args},priority);break;default:newOpts={priority:0,message:message,args:args};}return(0,_assert2.default)(_NumberisFinite(newOpts.priority)),'function'==typeof newOpts.message&&(newOpts.message=this._shouldLog(newOpts.priority)?newOpts.message():''),(0,_assert2.default)('string'==typeof newOpts.message||'object'===_typeof(newOpts.message)),newOpts}},{key:'_decorateMessage',value:function _decorateMessage(message,opts){if('string'==typeof message){var time='';if(opts.time){var _getElapsedTime3=this._getElapsedTime(),total=_getElapsedTime3.total;time=(0,_formatters.leftPad)((0,_formatters.formatTime)(total))}message=opts.time?this.id+': '+time+' '+message:this.id+': '+time+' '+message,message=(0,_color.addColor)(message,opts.color,opts.background)}return message}},{key:'priority',set:function set(newPriority){return this._storage.updateConfiguration({priority:newPriority}),this},get:function get(){return this._storage.config.priority}}]),Log}();exports.default=Log,Log.VERSION=_globals.VERSION; | ||
'use strict';var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&'function'==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj},_createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_globals=require('./utils/globals'),_localStorage=require('./utils/local-storage'),_localStorage2=_interopRequireDefault(_localStorage),_timestamp=require('./utils/timestamp'),_formatters=require('./utils/formatters'),_color=require('./utils/color'),_autobind=require('./utils/autobind'),_assert=require('../lib/utils/assert'),_assert2=_interopRequireDefault(_assert);Object.defineProperty(exports,'__esModule',{value:!0});function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}return Array.from(arr)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}var originalConsole={debug:_globals.isBrowser?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},DEFAULT_SETTINGS={enabled:!1,priority:0};function noop(){}var cache={};function getTableHeader(table){for(var key in table)for(var title in table[key])return title||'untitled';return'empty'}var Log=function(){function Log(){var _ref=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},id=_ref.id;_classCallCheck(this,Log),this.id=id,this.VERSION=_globals.VERSION,this._startTs=(0,_timestamp.getTimestamp)(),this._deltaTs=(0,_timestamp.getTimestamp)(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new _localStorage2.default('__probe-'+this.id+'__',DEFAULT_SETTINGS),this.userData={},this.timeStamp(this.id+' started'),(0,_autobind.autobind)(this),Object.seal(this)}var _NumberisFinite=Number.isFinite;return _createClass(Log,[{key:'isEnabled',value:function isEnabled(){return this._storage.config.enabled}},{key:'getPriority',value:function getPriority(){return this._storage.config.priority}},{key:'getLevel',value:function getLevel(){return this._storage.config.priority}},{key:'getTotal',value:function getTotal(){return+((0,_timestamp.getTimestamp)()-this._startTs).toPrecision(10)}},{key:'getDelta',value:function getDelta(){return+((0,_timestamp.getTimestamp)()-this._deltaTs).toPrecision(10)}},{key:'enable',value:function enable(){var enabled=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:enabled}),this}},{key:'setLevel',value:function setLevel(level){return this._storage.updateConfiguration({priority:level}),this}},{key:'warn',value:function warn(message){for(var _len=arguments.length,args=Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];return this._getLogFunction({message:message,args:args,method:originalConsole.warn,once:!0})}},{key:'error',value:function error(message){for(var _len2=arguments.length,args=Array(1<_len2?_len2-1:0),_key2=1;_key2<_len2;_key2++)args[_key2-1]=arguments[_key2];return this._getLogFunction({message:message,args:args,method:originalConsole.error})}},{key:'deprecated',value:function deprecated(oldUsage,newUsage){return this.warn('`'+oldUsage+'` is deprecated and will be removed in a later version. Use `'+newUsage+'` instead')}},{key:'removed',value:function removed(oldUsage,newUsage){return this.error('`'+oldUsage+'` has been removed. Use `'+newUsage+'` instead')}},{key:'probe',value:function probe(priority,message){for(var _len3=arguments.length,args=Array(2<_len3?_len3-2:0),_key3=2;_key3<_len3;_key3++)args[_key3-2]=arguments[_key3];return this._getLogFunction({priority:priority,message:message,args:args,method:originalConsole.log,time:!0})}},{key:'log',value:function log(priority,message){for(var _len4=arguments.length,args=Array(2<_len4?_len4-2:0),_key4=2;_key4<_len4;_key4++)args[_key4-2]=arguments[_key4];return this._getLogFunction({priority:priority,message:message,args:args,method:originalConsole.debug})}},{key:'info',value:function info(priority,message){for(var _len5=arguments.length,args=Array(2<_len5?_len5-2:0),_key5=2;_key5<_len5;_key5++)args[_key5-2]=arguments[_key5];return this._getLogFunction({priority:priority,message:message,args:args,method:console.info})}},{key:'once',value:function once(priority,message){for(var _len6=arguments.length,args=Array(2<_len6?_len6-2:0),_key6=2;_key6<_len6;_key6++)args[_key6-2]=arguments[_key6];return this._getLogFunction({priority:priority,message:message,args:args,method:originalConsole.debug||originalConsole.info,once:!0})}},{key:'table',value:function table(priority,_table,columns){if(_table){var tag=getTableHeader(_table);return this._getLogFunction({priority:priority,message:_table,args:columns&&[columns],tag:tag,method:console.table||noop})}return noop}},{key:'image',value:function image(_ref2){var priority=_ref2.priority,_image=_ref2.image,_ref2$message=_ref2.message,message=void 0===_ref2$message?'':_ref2$message,_ref2$scale=_ref2.scale,scale=void 0===_ref2$scale?1:_ref2$scale;if(priority>this.getPriority())return noop;if('undefined'==typeof window)return noop;if('string'==typeof _image){var img=new Image;img.onload=function(){return console.log(_formatters.formatImage.bind(null,img,message,scale))},img.src=_image}var element=_image.nodeName||'';if('img'===element.toLowerCase()&&console.log((0,_formatters.formatImage)(_image,message,scale)),'canvas'===element.toLowerCase()){var _img=new Image;_img.onload=function(){return console.log(_formatters.formatImage.bind(null,_img,message,scale))},_img.src=_image.toDataURL()}return noop}},{key:'time',value:function time(priority,message){return this._getLogFunction({priority:priority,message:message,method:console.time?console.time:console.info})}},{key:'timeEnd',value:function timeEnd(priority,message){return this._getLogFunction({priority:priority,message:message,method:console.timeEnd?console.timeEnd:console.info})}},{key:'timeStamp',value:function timeStamp(priority,message){return this._getLogFunction({priority:priority,message:message,method:console.timeStamp||noop})}},{key:'group',value:function group(priority,message){var opts=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};opts=this._parseArguments({priority:priority,message:message,opts:opts});var _opts=opts,collapsed=_opts.collapsed;return this._getLogFunction({priority:priority,message:message,opts:opts,method:(collapsed?console.groupCollapsed:console.group)||console.info})}},{key:'groupCollapsed',value:function groupCollapsed(priority,message){var opts=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return this.group(priority,message,Object.assign({},opts,{collapsed:!0}))}},{key:'groupEnd',value:function groupEnd(priority){return this._getLogFunction({priority:priority,message:'',method:console.groupEnd||noop})}},{key:'withGroup',value:function withGroup(priority,message,func){var opts=this._parseArguments({priority:priority,message:message});this.group(opts);try{func()}finally{this.groupEnd(opts.message)}}},{key:'trace',value:function trace(){console.trace&&console.trace()}},{key:'_shouldLog',value:function _shouldLog(priority){return(0,_assert2.default)(_NumberisFinite(priority),'log priority must be a number'),0===priority||this.isEnabled()&&this.getPriority()>=priority}},{key:'_getElapsedTime',value:function _getElapsedTime(){var total=this.getTotal(),delta=this.getDelta();return this._deltaTs=(0,_timestamp.getTimestamp)(),{total:total,delta:delta}}},{key:'_getLogFunction',value:function _getLogFunction(opts){var _opts2=opts,method=_opts2.method;if(opts=this._parseArguments(opts),(0,_assert2.default)(method),this._shouldLog(opts.priority)){var _opts3=opts,message=_opts3.message,tag=opts.tag||opts.message;if(opts.once)if(!cache[tag])cache[tag]=(0,_timestamp.getTimestamp)();else return noop;return message=this._decorateMessage(message,opts),method.bind.apply(method,[console,message].concat(_toConsumableArray(opts.args)))}return noop}},{key:'_parseArguments',value:function _parseArguments(options){var priority=options.priority,message=options.message,_options$args=options.args,args=void 0===_options$args?[]:_options$args,_options$opts=options.opts,opts=void 0===_options$opts?{}:_options$opts,normOpts=this._normalizeArguments({priority:priority,message:message,args:args}),_getElapsedTime2=this._getElapsedTime(),delta=_getElapsedTime2.delta,total=_getElapsedTime2.total;return Object.assign(options,normOpts,opts,{delta:delta,total:total})}},{key:'_normalizeArguments',value:function _normalizeArguments(_ref3){var priority=_ref3.priority,message=_ref3.message,_ref3$args=_ref3.args,args=void 0===_ref3$args?[]:_ref3$args,newOpts=null;switch('undefined'==typeof priority?'undefined':_typeof(priority)){case'number':(0,_assert2.default)(0<=priority),newOpts={priority:priority,message:message,args:args};break;case'string':case'function':void 0!==message&&args.unshift(message),newOpts={priority:0,message:priority,args:args};break;case'object':newOpts=Object.assign({priority:0,message:message,args:args},priority);break;default:newOpts={priority:0,message:message,args:args};}return(0,_assert2.default)(_NumberisFinite(newOpts.priority)),'function'==typeof newOpts.message&&(newOpts.message=this._shouldLog(newOpts.priority)?newOpts.message():''),(0,_assert2.default)('string'==typeof newOpts.message||'object'===_typeof(newOpts.message)),newOpts}},{key:'_decorateMessage',value:function _decorateMessage(message,opts){if('string'==typeof message){var time='';if(opts.time){var _getElapsedTime3=this._getElapsedTime(),total=_getElapsedTime3.total;time=(0,_formatters.leftPad)((0,_formatters.formatTime)(total))}message=opts.time?this.id+': '+time+' '+message:this.id+': '+message,message=(0,_color.addColor)(message,opts.color,opts.background)}return message}},{key:'priority',set:function set(newPriority){return this._storage.updateConfiguration({priority:newPriority}),this},get:function get(){return this._storage.config.priority}}]),Log}();exports.default=Log,Log.VERSION=_globals.VERSION; | ||
//# sourceMappingURL=log.js.map |
@@ -1,2 +0,2 @@ | ||
'use strict';var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&'function'==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj},isBrowser='object'!==('undefined'==typeof process?'undefined':_typeof(process))||'[object process]'!==process+''||process.browser,window_='undefined'==typeof window?global:window,document_='undefined'==typeof document?{}:document,global_='undefined'==typeof global?window:global,process_='object'===('undefined'==typeof process?'undefined':_typeof(process))?process:{},VERSION='1.0.0-alpha.10';Object.defineProperty(exports,'__esModule',{value:!0});exports.window=window_,exports.document=document_,exports.global=global_,exports.process=process_,exports.console=console,exports.isBrowser=isBrowser,exports.VERSION=VERSION; | ||
'use strict';var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&'function'==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj},isBrowser='object'!==('undefined'==typeof process?'undefined':_typeof(process))||'[object process]'!==process+''||process.browser,window_='undefined'==typeof window?global:window,document_='undefined'==typeof document?{}:document,global_='undefined'==typeof global?window:global,process_='object'===('undefined'==typeof process?'undefined':_typeof(process))?process:{},VERSION='1.0.0-alpha.11';Object.defineProperty(exports,'__esModule',{value:!0});exports.window=window_,exports.document=document_,exports.global=global_,exports.process=process_,exports.console=console,exports.isBrowser=isBrowser,exports.VERSION=VERSION; | ||
//# sourceMappingURL=globals.js.map |
@@ -1,2 +0,2 @@ | ||
'use strict';var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_color=require('../../lib/utils/color');Object.defineProperty(exports,'__esModule',{value:!0});function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}var ERR_AUTOMATION='Browser automation error. Check stack trace.\n Also note that Chrome 64 or higher is required.',DEFAULT_CONFIG={process:'./node_modules/.bin/webpack-dev-server',parameters:['--config','webpack.config.js'],options:{maxBuffer:5120000}},DEFAULT_PUPPETEER_OPTIONS={headless:!1,executablePath:'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'},BrowserDriver=function(){function BrowserDriver(){_classCallCheck(this,BrowserDriver),this.execFile=module.require('child_process').execFile,this.puppeteer=module.require('puppeteer'),this.console=module.require('console'),this.process=module.require('process'),this.child=null,this.browser=null,this.page=null,this.shellStatus=0}return _createClass(BrowserDriver,[{key:'setShellStatus',value:function setShellStatus(success){this.shellStatus=success?0:1}},{key:'startBrowser',value:function startBrowser(){var _this=this,options=0<arguments.length&&void 0!==arguments[0]?arguments[0]:DEFAULT_PUPPETEER_OPTIONS;return this.browser?Promise.resolve(this.browser):this.puppeteer.launch(options).then(function(browser){_this.browser=browser}).catch(function(error){throw console.error((0,_color.addColor)(ERR_AUTOMATION,_color.COLOR.BRIGHT_RED)),error})}},{key:'newPage',value:function newPage(){var _this2=this,_ref=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},_ref$url=_ref.url,url=void 0===_ref$url?'http://localhost:8080':_ref$url,_ref$width=_ref.width,width=void 0===_ref$width?1550:_ref$width,_ref$height=_ref.height,height=void 0===_ref$height?850:_ref$height;return this.startBrowser().then(function(){return _this2.browser.newPage()}).then(function(page){_this2.page=page}).then(function(){return _this2.page.waitFor(1e3)}).then(function(){return _this2.page.goto(url)}).then(function(){return _this2.page.setViewport({width:1550,height:850})}).catch(function(error){throw console.error((0,_color.addColor)(ERR_AUTOMATION,_color.COLOR.BRIGHT_RED)),error})}},{key:'exposeFunction',value:function exposeFunction(){var _this3=this,name=0<arguments.length&&void 0!==arguments[0]?arguments[0]:'testDriverDone';return new Promise(function(resolve){_this3.page.exposeFunction(name,resolve)})}},{key:'stopBrowser',value:function stopBrowser(){var _this4=this;return Promise.resolve().then(function(){return _this4.page.waitFor(1e3)}).then(function(){return _this4.browser.close()}).catch(function(error){throw console.error((0,_color.addColor)(ERR_AUTOMATION,_color.COLOR.BRIGHT_RED)),error})}},{key:'startServer',value:function startServer(){var _this5=this,config=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.child=this.execFile(config.process||DEFAULT_CONFIG.process,config.parameters||DEFAULT_CONFIG.parameters,config.options||DEFAULT_CONFIG.options,function(err,stdout){return err?void _this5.console.error(err):void _this5.console.log(stdout)})}},{key:'stopServer',value:function stopServer(){this.child&&(this.child.kill(),this.child=null)}},{key:'exitProcess',value:function exitProcess(){this.process.exit(this.shellStatus)}},{key:'exit',value:function exit(){var _this6=this;return Promise.all([this.stopBrowser(),this.stopServer()]).then(function(){return _this6.exitProcess()})}}]),BrowserDriver}();exports.default=BrowserDriver; | ||
'use strict';var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_color=require('../../lib/utils/color'),_log=require('../../lib/log'),_log2=_interopRequireDefault(_log);Object.defineProperty(exports,'__esModule',{value:!0});function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}return Array.from(arr)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}var log=new _log2.default({id:'render-test'}),DEFAULT_CONFIG={process:'./node_modules/.bin/webpack-dev-server',parameters:['--config','webpack.config.js'],port:5e3,options:{maxBuffer:5120000}},DEFAULT_PUPPETEER_OPTIONS={headless:!1},BrowserDriver=function(){function BrowserDriver(){_classCallCheck(this,BrowserDriver),this.execFile=module.require('child_process').execFile,this.puppeteer=module.require('puppeteer'),this.console=module.require('console'),this.process=module.require('process'),this.child=null,this.browser=null,this.page=null,this.port=null,this.shellStatus=0}return _createClass(BrowserDriver,[{key:'setShellStatus',value:function setShellStatus(success){this.shellStatus=success?0:1}},{key:'startBrowser',value:function startBrowser(){var _this=this,options=0<arguments.length&&void 0!==arguments[0]?arguments[0]:DEFAULT_PUPPETEER_OPTIONS;return this.browser?Promise.resolve(this.browser):this.puppeteer.launch(options).then(function(browser){_this.browser=browser})}},{key:'newPage',value:function newPage(){var _this2=this,_ref=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},_ref$url=_ref.url,url=void 0===_ref$url?'http://localhost':_ref$url,_ref$width=_ref.width,width=void 0===_ref$width?1550:_ref$width,_ref$height=_ref.height,height=void 0===_ref$height?850:_ref$height;return log.log({message:'Connecting to port: '+this.port,color:_color.COLOR.YELLOW})(),this.startBrowser().then(function(){return _this2.browser.newPage()}).then(function(page){_this2.page=page}).then(function(){return _this2.page.waitFor(1e3)}).then(function(){return _this2.page.goto(url+':'+_this2.port)}).then(function(){return _this2.page.setViewport({width:1550,height:850})})}},{key:'exposeFunction',value:function exposeFunction(){var _this3=this,name=0<arguments.length&&void 0!==arguments[0]?arguments[0]:'testDriverDone';return new Promise(function(resolve){_this3.page.exposeFunction(name,resolve)})}},{key:'stopBrowser',value:function stopBrowser(){var _this4=this;return Promise.resolve().then(function(){return _this4.page.waitFor(1e3)}).then(function(){return _this4.browser.close()})}},{key:'startServer',value:function startServer(){var _this5=this,config=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},maxRetryTimes=1<arguments.length&&void 0!==arguments[1]?arguments[1]:30,newConfig=Object.assign({},DEFAULT_CONFIG,config);return new Promise(function(resolve,reject){log.log({message:'Binding to port: '+newConfig.port,color:_color.COLOR.YELLOW})();var timeout=setTimeout(function(){resolve()},2e3);_this5.child=_this5.execFile(newConfig.process,[].concat(_toConsumableArray(newConfig.parameters),['--port',''+newConfig.port]),newConfig.options,function(error){error&&(clearTimeout(timeout),log.log({message:'Failed to bind port: '+newConfig.port,color:_color.COLOR.YELLOW})(),reject(error))})}).then(function(){_this5.port=newConfig.port}).catch(function(error){if(0<maxRetryTimes)return newConfig.port++,_this5.startServer(newConfig,maxRetryTimes-1);throw log.log({message:'Failed to start server, use \'killall node\' to stop existing services',color:_color.COLOR.RED})(),error})}},{key:'stopServer',value:function stopServer(){this.child&&(this.child.kill(),this.child=null)}},{key:'exitProcess',value:function exitProcess(){this.process.exit(this.shellStatus)}},{key:'exit',value:function exit(){var _this6=this;return Promise.resolve().then(function(){return _this6.stopBrowser()}).then(function(){_this6.stopServer(),_this6.exitProcess()})}}]),BrowserDriver}();exports.default=BrowserDriver; | ||
//# sourceMappingURL=browser-driver.js.map |
@@ -1,2 +0,2 @@ | ||
'use strict';var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_browserDriver=require('./browser-driver'),_browserDriver2=_interopRequireDefault(_browserDriver),_color=require('../../lib/utils/color'),_log=require('../../lib/log'),_log2=_interopRequireDefault(_log);Object.defineProperty(exports,'__esModule',{value:!0});function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return call&&('object'==typeof call||'function'==typeof call)?call:self}function _inherits(subClass,superClass){if('function'!=typeof superClass&&null!==superClass)throw new TypeError('Super expression must either be null or a function, not '+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var log=new _log2.default('render-test'),webpackEnv='render';3<=process.argv.length&&(webpackEnv=process.argv[2]);var DEFAULT_CONFIG={title:'BrowserTestDriver: tests',exposeFunction:'taskComplete',parameters:['--env.'+webpackEnv]},BrowserTestDriver=function(_BrowserDriver){function BrowserTestDriver(){return _classCallCheck(this,BrowserTestDriver),_possibleConstructorReturn(this,(BrowserTestDriver.__proto__||Object.getPrototypeOf(BrowserTestDriver)).apply(this,arguments))}return _inherits(BrowserTestDriver,_BrowserDriver),_createClass(BrowserTestDriver,[{key:'run',value:function run(){var _this2=this,config=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};config=Object.assign(DEFAULT_CONFIG,config);var _config=config,title=_config.title,exposeFunction=_config.exposeFunction;return this.title=title,log.log({message:title+' starting. Starting Chrome instance, waiting for '+exposeFunction+'...',color:_color.COLOR.YELLOW})(),this.time=Date.now(),Promise.resolve().then(function(){return _this2.startServer(config)}).then(function(){return _this2.startBrowser()}).then(function(){return _this2.newPage()}).then(function(){return _this2.exposeFunction(exposeFunction)}).then(function(resultString){var result=JSON.parse(resultString),ok=result.success===!!result.success&&(!result.failedTest||'string'==typeof result.failedTest);if(!ok)throw new Error('Illegal response "'+resultString+'" returned from Chrome test script');if(!result.success)throw new Error(result.failedTest||'Unknown failure');_this2._success()}).catch(function(error){_this2._failure(error)})}},{key:'_success',value:function _success(){var elapsed=((Date.now()-this.time)/1e3).toFixed(1);log.log({message:this.title+' successfully completed in '+elapsed+'s!',color:_color.COLOR.BRIGHT_GREEN})(),this.setShellStatus(!0),this.exit()}},{key:'_failure',value:function _failure(error){log.log({message:this.title+' failed: '+error.message+'. Keeping browser open to allow debugging.',color:_color.COLOR.BRIGHT_RED})(),this.setShellStatus(!1)}}]),BrowserTestDriver}(_browserDriver2.default);exports.default=BrowserTestDriver; | ||
'use strict';var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_browserDriver=require('./browser-driver'),_browserDriver2=_interopRequireDefault(_browserDriver),_color=require('../../lib/utils/color'),_log=require('../../lib/log'),_log2=_interopRequireDefault(_log);Object.defineProperty(exports,'__esModule',{value:!0});function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return call&&('object'==typeof call||'function'==typeof call)?call:self}function _inherits(subClass,superClass){if('function'!=typeof superClass&&null!==superClass)throw new TypeError('Super expression must either be null or a function, not '+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var log=new _log2.default({id:'render-test'}),webpackEnv='render';3<=process.argv.length&&(webpackEnv=process.argv[2]);var DEFAULT_CONFIG={title:'BrowserTest',exposeFunction:'taskComplete',parameters:['--env.'+webpackEnv]},BrowserTestDriver=function(_BrowserDriver){function BrowserTestDriver(){return _classCallCheck(this,BrowserTestDriver),_possibleConstructorReturn(this,(BrowserTestDriver.__proto__||Object.getPrototypeOf(BrowserTestDriver)).apply(this,arguments))}return _inherits(BrowserTestDriver,_BrowserDriver),_createClass(BrowserTestDriver,[{key:'run',value:function run(){var _this2=this,config=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};config=Object.assign(DEFAULT_CONFIG,config);var _config=config,title=_config.title,exposeFunction=_config.exposeFunction;return this.title=title,log.log({message:title+' started. Launching Chromium instance, waiting for '+exposeFunction+'...',color:_color.COLOR.YELLOW})(),this.time=Date.now(),Promise.resolve().then(function(){return _this2.startServer(config)}).then(function(){return _this2.startBrowser()}).then(function(){return _this2.newPage()}).then(function(){return _this2.exposeFunction(exposeFunction)}).then(function(resultString){var result=JSON.parse(resultString),ok=result.success===!!result.success&&(!result.failedTest||'string'==typeof result.failedTest);if(!ok)throw new Error('Illegal response "'+resultString+'" returned from Chrome test script');if(!result.success)throw new Error(result.failedTest||'Unknown failure');_this2._success()}).catch(function(error){_this2._failure(error)})}},{key:'_success',value:function _success(){var elapsed=((Date.now()-this.time)/1e3).toFixed(1);log.log({message:this.title+' successfully completed in '+elapsed+'s!',color:_color.COLOR.BRIGHT_GREEN})(),this.setShellStatus(!0),this.exit()}},{key:'_failure',value:function _failure(error){log.log({message:this.title+' failed: '+error.message+'. Keeping browser open to allow debugging.',color:_color.COLOR.BRIGHT_RED})(),this.setShellStatus(!1)}}]),BrowserTestDriver}(_browserDriver2.default);exports.default=BrowserTestDriver; | ||
//# sourceMappingURL=browser-test-driver.js.map |
@@ -1,2 +0,2 @@ | ||
'use strict';Object.defineProperty(exports,'__esModule',{value:!0}),exports.makeSpy=makeSpy;function makeSpy(obj,func){var methodName;return obj||func?'function'!=typeof obj||func?(methodName=func,func=obj[methodName]):(func=obj,obj={},methodName=func.name+'-spy'):(func=function(){},obj={},methodName='spy'),wrapFunction(obj,func,methodName)}function wrapFunction(obj,func,methodName){function spy(){spy.callCount++,spy.called=!0;for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return func.apply(this,args)}return void 0===func.func?(Object.assign(spy,{reset:function reset(){spy.callCount=0,spy.called=!1},restore:function restore(){obj[methodName]=func},obj:obj,methodName:methodName,func:func,method:func}),spy.reset(),obj[methodName]=spy,spy):func} | ||
'use strict';Object.defineProperty(exports,'__esModule',{value:!0}),exports.makeSpy=makeSpy;function makeSpy(obj,func){var methodName;return obj||func?'function'!=typeof obj||func?(methodName=func,func=obj[methodName]):(func=obj,obj={},methodName=func.name+'-spy'):(func=function(){},obj={},methodName='spy'),wrapFunction(obj,func,methodName)}function wrapFunction(obj,func,methodName){function spy(){spy.callCount++,spy.called=!0;for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return'returnValue'in spy?spy.returnValue:func.apply(this,args)}return void 0===func.func?(Object.assign(spy,{reset:function reset(){spy.callCount=0,spy.called=!1},restore:function restore(){obj[methodName]=func},returns:function returns(returnValue){spy.returnValue=returnValue},obj:obj,methodName:methodName,func:func,method:func}),spy.reset(),obj[methodName]=spy,spy):func} | ||
//# sourceMappingURL=make-spy.js.map |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.0-alpha.10", | ||
"version": "1.0.0-alpha.11", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "javascript", |
@@ -445,3 +445,3 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
} | ||
message = opts.time ? `${this.id}: ${time} ${message}` : `${this.id}: ${time} ${message}`; | ||
message = opts.time ? `${this.id}: ${time} ${message}` : `${this.id}: ${message}`; | ||
message = addColor(message, opts.color, opts.background); | ||
@@ -448,0 +448,0 @@ } |
@@ -21,11 +21,10 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc. | ||
// TODO - use a Log | ||
import {addColor, COLOR} from '../../lib/utils/color'; | ||
import {COLOR} from '../../lib/utils/color'; | ||
import Log from '../../lib/log'; | ||
const log = new Log({id: 'render-test'}); | ||
const ERR_AUTOMATION = `Browser automation error. Check stack trace. | ||
Also note that Chrome 64 or higher is required.`; | ||
const DEFAULT_CONFIG = { | ||
process: './node_modules/.bin/webpack-dev-server', | ||
parameters: ['--config', 'webpack.config.js'], | ||
port: 5000, | ||
options: {maxBuffer: 5000 * 1024} | ||
@@ -35,8 +34,6 @@ }; | ||
const DEFAULT_PUPPETEER_OPTIONS = { | ||
headless: false, | ||
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' | ||
headless: false | ||
}; | ||
export default class BrowserDriver { | ||
constructor() { | ||
@@ -51,2 +48,3 @@ this.execFile = module.require('child_process').execFile; | ||
this.page = null; | ||
this.port = null; | ||
this.shellStatus = 0; | ||
@@ -68,10 +66,10 @@ } | ||
this.browser = browser; | ||
}) | ||
.catch(error => { | ||
console.error(addColor(ERR_AUTOMATION, COLOR.BRIGHT_RED)); // eslint-disable-line | ||
throw error; | ||
}); | ||
} | ||
newPage({url = 'http://localhost:8080', width = 1550, height = 850} = {}) { | ||
newPage({url = 'http://localhost', width = 1550, height = 850} = {}) { | ||
log.log({ | ||
message: `Connecting to port: ${this.port}`, | ||
color: COLOR.YELLOW | ||
})(); | ||
return this.startBrowser() | ||
@@ -83,8 +81,4 @@ .then(_ => this.browser.newPage()) | ||
.then(_ => this.page.waitFor(1000)) | ||
.then(_ => this.page.goto(url)) | ||
.then(_ => this.page.setViewport({width: 1550, height: 850})) | ||
.catch(error => { | ||
console.error(addColor(ERR_AUTOMATION, COLOR.BRIGHT_RED)); // eslint-disable-line | ||
throw error; | ||
}); | ||
.then(_ => this.page.goto(`${url}:${this.port}`)) | ||
.then(_ => this.page.setViewport({width: 1550, height: 850})); | ||
} | ||
@@ -101,22 +95,46 @@ | ||
.then(_ => this.page.waitFor(1000)) | ||
.then(_ => this.browser.close()) | ||
.catch(error => { | ||
console.error(addColor(ERR_AUTOMATION, COLOR.BRIGHT_RED)); // eslint-disable-line | ||
throw error; | ||
}); | ||
.then(_ => this.browser.close()); | ||
} | ||
startServer(config = {}) { | ||
this.child = this.execFile( | ||
config.process || DEFAULT_CONFIG.process, | ||
config.parameters || DEFAULT_CONFIG.parameters, | ||
config.options || DEFAULT_CONFIG.options, | ||
(err, stdout) => { | ||
if (err) { | ||
this.console.error(err); | ||
return; | ||
startServer(config = {}, maxRetryTimes = 30) { | ||
const newConfig = Object.assign({}, DEFAULT_CONFIG, config); | ||
return new Promise((resolve, reject) => { | ||
log.log({ | ||
message: `Binding to port: ${newConfig.port}`, | ||
color: COLOR.YELLOW | ||
})(); | ||
const timeout = setTimeout(() => { // eslint-disable-line | ||
resolve(); | ||
}, 2000); | ||
this.child = this.execFile( | ||
newConfig.process, | ||
[...newConfig.parameters, '--port', `${newConfig.port}`], | ||
newConfig.options, | ||
error => { | ||
if (error) { | ||
clearTimeout(timeout); // eslint-disable-line | ||
log.log({ | ||
message: `Failed to bind port: ${newConfig.port}`, | ||
color: COLOR.YELLOW | ||
})(); | ||
reject(error); | ||
} | ||
} | ||
this.console.log(stdout); | ||
} | ||
); | ||
); | ||
}) | ||
.then(() => { | ||
this.port = newConfig.port; | ||
}) | ||
.catch(error => { | ||
if (maxRetryTimes > 0) { | ||
newConfig.port++; | ||
return this.startServer(newConfig, maxRetryTimes - 1); | ||
} else { // eslint-disable-line | ||
log.log({ | ||
message: 'Failed to start server, use \'killall node\' to stop existing services', | ||
color: COLOR.RED | ||
})(); | ||
throw error; | ||
} | ||
}); | ||
} | ||
@@ -137,4 +155,9 @@ | ||
exit() { | ||
return Promise.all([this.stopBrowser(), this.stopServer()]).then(_ => this.exitProcess()); | ||
return Promise.resolve() | ||
.then(() => this.stopBrowser()) | ||
.then(() => { | ||
this.stopServer(); | ||
this.exitProcess(); | ||
}); | ||
} | ||
} |
@@ -26,3 +26,3 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc. | ||
const log = new Log('render-test'); | ||
const log = new Log({id: 'render-test'}); | ||
@@ -38,3 +38,3 @@ // DEFAULT config, intended to be overridden in the node script that calls us | ||
const DEFAULT_CONFIG = { | ||
title: 'BrowserTestDriver: tests', | ||
title: 'BrowserTest', | ||
exposeFunction: 'taskComplete', | ||
@@ -50,3 +50,3 @@ parameters: [`--env.${webpackEnv}`] | ||
log.log({ | ||
message: `${title} starting. Starting Chrome instance, waiting for ${exposeFunction}...`, | ||
message: `${title} started. Launching Chromium instance, waiting for ${exposeFunction}...`, | ||
color: COLOR.YELLOW | ||
@@ -64,3 +64,4 @@ })(); | ||
const result = JSON.parse(resultString); | ||
const ok = result.success === Boolean(result.success) && | ||
const ok = | ||
result.success === Boolean(result.success) && | ||
(!result.failedTest || typeof result.failedTest === 'string'); | ||
@@ -67,0 +68,0 @@ if (!ok) { |
@@ -37,3 +37,3 @@ // Inspired by https://github.com/popomore/spy | ||
/* eslint-disable no-invalid-this */ | ||
return func.apply(this, args); | ||
return 'returnValue' in spy ? spy.returnValue : func.apply(this, args); | ||
} | ||
@@ -52,2 +52,6 @@ | ||
returns(returnValue) { | ||
spy.returnValue = returnValue; | ||
}, | ||
obj, | ||
@@ -54,0 +58,0 @@ methodName, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
215069
1861