
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
npm install mactest
Assuming you are running a server with express, this will create a page available at http://yourserver.host/mactest, where your tests will be listed, and can be executed
express = require('express') ;
mactest = require('mactest') ;
app = express() ;
app
.use(express.compress())
.use(express.logger())
.use(app.router) ;
mactest.configure({rootPath: '/mactest', excludeSampleTests: false})
mactest.routes(app)
Say we want to test a module that resolves url redirects
mactest = require('mactest') ;
function resolve(url, callback) {..};
module.exports = resolve ;
mactest.add( 'util functions > url resolve', function(result, fn){
var short = 'http://bit.ly/19VYAIz' ;
result.info('Will try to resolve url', short) ;
resolve(short, function(err, resolved){
if (resolved==='https://github.com/tifroz/mactest') {
result.success('succesfully resolved', 'resolved to %s', resolved) ;
} else if (resolved) {
result.failure('resolved but with incorrect value', 'resolved to %s', resolved) ;
}
fn(err, result)
})
})
Now your browser should show a util functions > url resolve link when you got to http://my.host/mactest (and you can execute the test & visualize the outcome by clicking the link)
mactest.configure(options) to configure mactest
options is a hash with 2 keys:
rootPath (string, defaults to /mactest) is the path on your server to access the page where all your tests are listedexcludeSampleTests (boolean, defaults to false) unless you override, you will see some built-in mock tests in addition to the tests you have defined in your codemactest.add(name, testFn) to add a test suite
(result, callback) signature. Use result.info(..), result.failure(..), result.success(..) any (multiple) time to report failure, info, success at different step of execution, then call callback(error, result) after the test suite has completed its executionFAQs
An express library for hackers, for on-the-go, quick'n dirty unit testing
The npm package mactest receives a total of 2 weekly downloads. As such, mactest popularity was classified as not popular.
We found that mactest 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.