New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

highkick

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

highkick - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

test/test_nested.js

52

lib/highkick.js

@@ -7,2 +7,3 @@ var _puts = require('sys').puts,

title = options.name ? (options.name).bold+' | '.grey : '';
var tests = Object.keys(module)

@@ -12,4 +13,2 @@ .filter(function(el){ return el.substring(0,5)=='test_' })

var test, next, startTS;
var ctr = 0,

@@ -26,5 +25,5 @@ len = tests.length,

process.stdout.write(error ? 'FAIL '.bold.red : 'OK '.green.bold);
_puts(test.name.bold.yellow + ' ('.grey+(ctr+'/'+len).bold+', '.grey + (( (new Date).getTime() - startTS )/1000+'s').white.bold+') '.grey)
_puts(test.name.bold.yellow + ' ('.grey+(ctr+'/'+len).bold+', '.grey + (( (new Date).getTime() - test.startTS)/1000+'s').white.bold+') '.grey)
if(error){
_puts('ERROR: '.bold.red+error.message.bold+'\n'+error.stack+')');
_puts('ERROR: '.bold.red+(error.message ? error.message.bold : '')+'\n'+error.stack+')');
}

@@ -45,30 +44,41 @@ }

function callTestFn(test, args, callback){
puts('Running '+test.name+' ...');
test.startTS = (new Date).getTime();
try {
test.apply(undefined,args);
} catch(error){
mark(test,error);
}
callback();
}
(function(i){
if(i>=tests.length){
if(i>=len){
puts('* All tests has been fired.'.grey);
if(tests.length==0) callback();
if(tests.length==0) callback(undefined, { 'len':0, 'fail':0 });
return;
}
test = tests[i];
next = arguments.callee.bind(undefined, i+1);
var test = tests[i],
next = arguments.callee.bind(undefined, i+1);
puts('Running '+test.name+' ...');
startTS = (new Date).getTime();
var args = [mark.bind(undefined,test)];
if(module.init){
args.splice(0,0,module.init());
}
typeof module.init != 'function' ? callTestFn(test, args, next) : module.init(options, function(error/* args to pass test functions */){
if(error) {
return callback(error);
}
try {
tests[i].apply(undefined,args);
} catch(error){
mark(test,error)
}
var mergeArgs = [0, 0];
Array.prototype.push.apply(mergeArgs, Array.prototype.slice.call(arguments, 1));
args.splice.apply(args, mergeArgs);
next();
callTestFn(test, args, next);
});

@@ -75,0 +85,0 @@ })(0);

{
"name":"highkick",
"version":"1.1.1",
"version":"1.2.0",
"description":"Asynchronous, no-style, super simple testing tool.",

@@ -5,0 +5,0 @@ "author":"Azer Koculu <azer@kodfabrik.com>",

@@ -1,8 +0,11 @@

var assert = require('assert');
var assert = require('assert'),
highkick = require('../lib/highkick');
function init(){
return 3.14;
function init(options, callback){
setTimeout(function(){
callback(null, 3.14);
}, 100);
}
function test_foo(pi, callback){
function test_async(pi, callback){
assert.equal(pi, 3.14);

@@ -14,3 +17,3 @@ setTimeout(function(){

function test_bar(pi, callback){
function test_sync(pi, callback){
assert.equal(pi, 3.14);

@@ -20,6 +23,15 @@ callback();

function test_nested(test, callback){
highkick({ module:require('./test_nested'), 'silent':false, 'name':' nested', foo:true },function(error,result){
!error && result.len == 0 && (error = new Error('Missing test functions.'));
if(error) return callback(error);
callback(result.fail ? new Error('Fail') : undefined);
});
}
module.exports = {
'init':init,
'test_foo':test_foo,
'test_bar':test_bar
'test_async':test_async,
'test_sync':test_sync,
'test_nested':test_nested
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc