
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

test.js is a compact testing module for node.js that simply wraps node's assert module and generates pretty printed output.
testjs)npm -g install testjs
Place your test suite in tests/suite.js.
// package.json
...
{
"devDependencies": {
"testjs": "latest"
},
"scripts": {
"test": "testjs"
}
}
...
npm test
// tests/run.js
var Suite = require("testjs");
Suite.run({
"firsttest": function(test) {
...
test.done();
},
...
});
// package.json
...
{
"scripts": {
"test": "node tests/run.js"
}
}
npm test
All of node's assert (just replace assert through test) plus test.notOk(...)
as a negated ok.
test#ok(actual) / test#notOk(actual) / test#ifError(actual)test#equal(actual, expected) / test#notEqual(actual, notExpected)test#deepEqual(actual, expected) / test#notDeepEqual(actual, notExpected)test#strictEqual(actual, expected) / test#notStrictEqual(actual, notExpected)test#throws(blockFunction[, classRegExpOrValidationFunction]) / test#doesNotThrow(blockFunction)There is also a test#log(...) for logging straight to the test console.
When typing testjs in a terminal, tests/suite.js will be run. Also supports running runners:
testjs tests/run.js or custom / other unit tests under the condition that the runner (here: run.js) does not export
anything. If it does, whatever it exports will be run.
test.js is partially interoperable with nodeunit. There is no setUp/tearDown however and there are no aliases for
things like equal, which is for example aliased as equals in nodeunit. However, test.js including dependencies is
about 100kb while nodeunit is about 16mb.
| Option | Function |
|---|---|
--nocolors or -nc | Disables terminal colors. |
--name=NAME or -n=NAME | Sets the suite name. Defaults to the name defined in package.json which is looked up inside of the current working directory or to the base name of the suite file if there is no package.json. The hard coded default is suite. |
--silent or -s | Does not produce any output. |
Always returns the number of failed tests as the status code.
Example: testjs --name=MyGame -nc tests/mygame-test.js
Apache License, Version 2.0
FAQs
A compact testing module for node.js.
The npm package testjs receives a total of 1,652 weekly downloads. As such, testjs popularity was classified as popular.
We found that testjs 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
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.