
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
WiTests is a lightweight, simple, and extensible testing library for Node.js projects. It allows you to define and run tests with a focus on clear organization and easy debugging.
Install WiTests as a dependency in your project:
npm install witests
Create test files (e.g., example.test.js) in your designated tests folder. Use the define and defineTestCases functions to register your tests:
// example.test.js
define("Basic addition", () => 1 + 2, 3);
define(
"Addition with nulls",
() => {
if (1 + null === null) throw new Error("Nulls cannot be summed");
},
{ error: "Nulls cannot be summed" }
);
defineTestCases("Sum of numbers", (a, b) => a + b, {
case1: { input: [1, 2], expected: 3 },
case2: { input: [null, 2], expected: { error: "Nulls cannot be summed" } },
});
Run all tests in the specified folder (tests by default) or a single file using the CLI.
witests
Running a single test file
witests ./tests/example.test.js
When you run the tests, WiTests will provide a detailed report:
Running WiTests...
Running tests from: example.test.js
Running test: Basic addition...
Test Basic addition passed! ✔️
Running test: Addition with nulls...
Test Addition with nulls passed! ✔️
Running test: Sum of numbers - case1...
Test Sum of numbers - case1 passed! ✔️
Running test: Sum of numbers - case2...
Test Sum of numbers - case2 passed! ✔️
All tests from example.test.js passed! 🎉
All tests passed globally! 🎉
define(name, testFn, expected)Define a single test.
name (string): The name of the test.testFn (function): The test function to execute.expected (any): The expected result. Use { error: "Error message" } for error tests.defineTestCases(name, testFn, cases)Define multiple tests from a collection of cases.
name (string): The base name for the tests.testFn (function): The test function to execute.cases (object): An object where keys are case names and values contain:
input (array): The input arguments for the test function.expected (any): The expected result.witestsRunner.run()Runs all registered tests, grouping results by file.
You can customize the output colors by passing an options object when creating the runner:
const witestsRunner = new WitestsRunner({
colors: {
success: "\x1b[32m",
failure: "\x1b[31m",
title: "\x1b[35m",
reset: "\x1b[0m",
},
});
MIT License. See LICENSE for details.
FAQs
A simple and extensible testing library
We found that witests demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

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.