Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
HighKick is a no-style, light-weight and powerful testing tool for NodeJS.
Screenshots:
$ npm install highkick
CoffeeScript:
init = (options, callback) ->
startWebServer callback
testFoo = (callback) ->
get "http://localhost/api/foo", (error, response) ->
if error
callback error
return
assert.equal response.foo 'foo'
callback()
end = (callback) ->
stopWebServer callback
module.exports =
init: init
testFoo: testFoo
end: end
JavaScript:
function init(options, callback){
startWebServer(callback);
}
function testFoo(callback){
get('http://localhost/api/foo', function(error, response){
if(error){
callback(error);
return;
}
assert.equal(response.foo, 'foo')
callback();
});
}
function end(callback){
stopWebServer(callback);
}
module.exports = {
'init': init,
'testFoo': testFoo,
'end': end
};
HighKick takes a module and executes the functions that have a name starting with "test". A simple test module would look like this;
var assert = require('assert');
exports.testFoo = function(callback){
try {
assert.something();
callback();
} catch (error) {
callback(error);
}
}
exports.testBar = function(callback){
setTimeout(callback, 100);
}
Below command will run the all tests defined in tests.js;
$ highkick tests.js
To specify the tests that needs to run;
$ KICK=foo highkick tests.js
se comma for separating multiple test names, and '*' for running all tests.
An init function is called before the execution of the tests in a module for once. Init functions take an options
object from HighKick and are able to
produce the first parameters of test functions as shown in the example below;
function init(options, callback){
callback( undefined, +(new Date), Math.PI );
}
exports.testFoo = function(timestamp, pi, callback){
...
}
Use beforeEach
to define a function to be called before each test.
function beforeEach(callback){
callback( undefined, +(new Date));
}
exports.testFoo = function(now, callback){
...
}
Similar to the init
functions, what a beforeEach
function produces is passed to test functions. The key difference is, beforeEach
functions take parameters from init
functions, too.
exports.init = function(options, callback){
callback(undefined, 'hello');
}
exports.beforeEach = function(hello, callback){
callback(undefined, 'world';
}
exports.testFoo = function(hello, world, callback){
...
}
An afterEach
function is called after each test, regardless of results.
exports.beforeEach = function(callback){
callback(undefined, new ChildProcess);
}
exports.testFoo = function(process, callback){
...
}
exports.afterEach = function(process, callback){
process.terminate();
callback();
}
Unlikely to afterEach
, an end
function is called after all tests are done.
exports.init = function(callback){
callback(undefined, new ChildProcess);
}
exports.testFoo = function(process, callback){
...
}
exports.end = function(process, callback){
process.terminate();
callback();
}
HighKick provides a very minimalistic concept of nested tests;
var highkick = require('highkick');
exports.testFoobar = highkick('./foobar');
To see the output of child tests;
$ VERBOSE=foobar highkick tests.js
You can use comma for separating multiple test names and pass '*' for enabling output for child tests.
In the case a custom callback is needed for getting a summary of testsuite:
highkick('./tests', function(error, result){
if(error){
logging.error('Ran %d tests, %d failed', result.len, result.fail);
logging.error(error);
}
logging.info('Ran %d tests successfully, without any error.', result.len);
});
Pass --async
option to run the tests asynchronously;
$ highkick tests.js --async
In the case you need the programmatic way;
var highkick = require('highkick');
highkick({ 'path': './tests', 'async': true }, function(error, result){
...
});
FAQs
This package name is not currently in use, but was formerly occupied by a popular package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.
The npm package highkick receives a total of 1 weekly downloads. As such, highkick popularity was classified as not popular.
We found that highkick demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.