
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
assert-runner
Advanced tools
Author: Rich Hildred inspired by Gabriel Llamas' answer to this stack overflow question.
License: MIT
Really light weight test runner based on node's builtin assert.
npm install assert-runner
Given a class TestClass under test:
var Toolbox = require('js-toolbox');
var TestClass = Toolbox.Base.extend({
constructor: function(){
return this;
},
synchronous: function(req, res){
res.end("synchronous test");
},
asynchronous: function(req, res, callback){
res.end("asynchronous test");
if(typeof callback != 'undefined') callback();
}
});
module.exports = TestClass;
TestClass can be tested using the following code (in test.js):
var TestRunner = require('TestRunner'),
assert = require('assert'),
TestClass = require('./classes/TestClass.js');
var oTest = null;
var tests = {
"TestClass constructor" : function(){
oTest = new TestClass();
assert(oTest != null);
},
"TestClass synchronous": function(){
var oReq = new TestRunner.TestRequest();
var oResp = new TestRunner.TestResponse();
oTest.synchronous(oReq, oResp);
assert(oResp.sBody == "synchronous test");
},
"Test asynchronous": function(done){
var oReq = new TestRunner.TestRequest();
var oResp = new TestRunner.TestResponse();
oTest.asynchronous(oReq, oResp, function(){
assert(oResp.sBody == "asynchronous test");
done();
});
}
};
new TestRunner(tests).again(0);
If we run node test.js
the output produced will be:
Passed Test: "TestClass constructor" 1 of 3
Passed Test: "TestClass synchronous" 2 of 3
Passed Test: "Test asynchronous" 3 of 3
Depends on:
FAQs
runs tests based on node's built in assert
The npm package assert-runner receives a total of 1 weekly downloads. As such, assert-runner popularity was classified as not popular.
We found that assert-runner 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.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.