Guest User

Untitled

a guest
Jan 23rd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. function testSupport(options){
  2. var noop = function(){};
  3. if (!options.name) throw Error('test needs a name');
  4. if (!options.root) options.root = testSupport.results = {};
  5. if (!options.success) options.success = noop;
  6. if (!options.failure) options.failure = noop;
  7. var run = function(options){
  8. var result = (typeof options.test === 'function') ? options.test(options) : options.test;
  9. options.root[options.name] = result;
  10. ([options.failure, options.success][+result])(options);
  11. return result;
  12. };
  13.  
  14. var result = run(options);
  15. if (!result && options.retest) result = run(options);
  16. return options.root[options.name] = result;
  17. }
Add Comment
Please, Sign In to add comment