
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.
@kompanie/testwerk
Advanced tools
A dependency-free, buildless test runner for browsers and node.js environments.
At first you need to install the package using the following command:
npm i @kompanie/testwerk
Tests are organized into classes.
Each public function is treated as a test.
If you need helper functions inside your test class, use private functions.
Async functions are also supported and will automatically fail if they reach the configured asyncTestTimeout.
The following examples use @kompanie/assert. You can use any other assertion library that throws errors if an assertion fails.
import { Assert } from "@kompanie/assert";
export class MyTests {
add_shouldCorrectlyAdd() {
const actual = 1 + 1;
Assert.equal(actual, 2);
}
async async_add_shouldCorrectlyAdd() {
await new Promise(resolve => setTimeout(resolve, 1000));
const actual = 1 + 1;
Assert.equal(actual, 2);
}
#myHelperFunction() {
// I'm not treated as test
}
afterAll() {
// Executed after all tests are finished
}
afterEach() {
// Runs after each individual test
}
beforeAll() {
// Runs before test execution starts
}
beforeEach() {
// Runs before each individual test
}
}
Your tests can be executed and visualized either as HTML (browser) or in the console (browser or node.js).
import { TestRunnerHtml } from "@kompanie/testwerk";
import { MyTests } from "./tests/myTest.js";
const runnerConfig = {
asyncTestTimeout: 5000,
afterEachTimeout: 500,
beforeEachTimeout: 500
}; // Optional, these are the defaults
const testResultContainer = document.getElementById("test-result-container");
const testRunnerHtml = new TestRunnerHtml(runnerConfig);
testRunnerHtml.run(testResultContainer, MyTest); // Add your test classes here. No array declaration needed.
import { TestRunnerConsole } from "@kompanie/testwerk";
import { MyTests } from "./tests/myTest.js";
const runnerConfig = {
asyncTestTimeout: 5000,
afterEachTimeout: 500,
beforeEachTimeout: 500
}; // Optional, these are the defaults
const testRunnerConsole = new TestRunnerConsole(runnerConfig);
testRunnerConsole.run(MyTest); // Add your test classes here. No array declaration needed.
You can also use your own code to parse and visualize the output of TestRunner.
import { TestRunner } from "@kompanie/testwerk";
import { MyOtherTests } from "./tests/myOtherTests.js";
const runnerConfig = {
asyncTestTimeout: 5000,
afterEachTimeout: 500,
beforeEachTimeout: 500
}; // Optional, these are the defaults
const testRunner = new TestRunner(runnerConfig);
const testResults = await testRunner.run(MyOtherTests); // Add your test classes here. No array declaration needed.
This example shows what testResults can look like.
{
"completionTime": 1739974557847,
"executionTime": 3014,
"testResults": [
{
"name": "MyOtherTests",
"results": [
{
"name": "throws_shouldFail_whenFunctionDoesNotThrowAsync",
"executionTime": 0,
"error": {
"columnNumber": 8,
"fileName": "http://localhost:8000/source/assert.js",
"lineNumber": 1,
"message": "Expected an error, but none was thrown",
"stack": "AssertionError@http://localhost:8000/source/assert.js:1:8..."
}
},
{
"name": "throws_shouldPass_whenFunctionThrowsAsync",
"executionTime": 2
}
]
}
]
}
Testwerk includes tests which can be run with the following command:
npm test
You can then open your browser. The test project outputs to the console and HTML. It also has three failing tests to show the visualization of failed tests in the console and the HTML.
FAQs
A dependency-free, buildless test runner for browsers and node.js
We found that @kompanie/testwerk demonstrated a healthy version release cadence and project activity because the last version was released less than 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.