
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
@bootstrapp/test
Advanced tools
A lightweight test framework for Bootstrapp applications. Supports both Node.js and browser testing environments with a familiar API.
npm install @bootstrapp/test
# Run all tests
bootstrapp test
# Run specific test file
bootstrapp test --file path/to/test.js
# Run browser tests
bootstrapp test --browser
# Run browser tests with visible browser
bootstrapp test --browser --headed
# Run tests in a specific project
bootstrapp test --project ./my-project
# Verbose output
bootstrapp test --verbose
import Testing from "@bootstrapp/test";
const { describe, it, assert, mock, beforeEach, afterEach, beforeAll, afterAll } = Testing;
Testing.suite("My Test Suite", () => {
describe("Feature Group", () => {
beforeEach(() => {
// Setup before each test
});
afterEach(() => {
// Cleanup after each test
});
it("should do something", () => {
assert.equal(1 + 1, 2);
});
it("should handle async", async () => {
const result = await fetchData();
assert.ok(result);
});
});
});
Mark tests as browser-only:
Testing.suite("Browser Tests", () => {
describe("DOM Tests", () => {
it("should create elements", () => {
const el = document.createElement("div");
assert.ok(el instanceof HTMLElement);
});
});
}, { env: "browser" });
import { assert } from "@bootstrapp/test/assert";
// Basic assertions
assert(condition); // Truthy check
assert.ok(value); // Same as assert()
assert.notOk(value); // Falsy check
// Equality
assert.equal(actual, expected); // Strict equality (===)
assert.notEqual(actual, expected); // Strict inequality (!==)
assert.deepEqual(actual, expected); // Deep object equality
// Type checks
assert.isTrue(value); // value === true
assert.isFalse(value); // value === false
assert.isNull(value); // value === null
assert.isNotNull(value); // value !== null
assert.isUndefined(value); // value === undefined
assert.isDefined(value); // value !== undefined
assert.isObject(value); // typeof value === "object"
assert.isFunction(value); // typeof value === "function"
assert.isArray(value); // Array.isArray(value)
// Collection checks
assert.include(haystack, needle); // Array/string includes
assert.notInclude(haystack, needle); // Array/string excludes
// Error handling
assert.throws(fn, /pattern/); // Function throws matching error
await assert.rejects(promise, /pattern/); // Promise rejects with matching error
import { mock } from "@bootstrapp/test/mock";
// Create a mock function
const mockFn = mock.fn();
// With default implementation
const mockFn = mock.fn((x) => x * 2);
// Set return values
mockFn.mockReturnValue(42);
mockFn.mockReturnValueOnce(100);
// Async return values
mockFn.mockResolvedValue({ data: "async" });
mockFn.mockResolvedValueOnce({ data: "once" });
mockFn.mockRejectedValue(new Error("fail"));
mockFn.mockRejectedValueOnce(new Error("fail once"));
// Custom implementation
mockFn.mockImplementation((x) => x + 1);
mockFn.mockImplementationOnce((x) => x * 10);
// Inspect calls
mockFn.mock.calls; // [[arg1, arg2], [arg1, arg2], ...]
mockFn.mock.calls.length; // Number of calls
mockFn.mock.lastCall; // Last call info
mockFn.mock.results; // [{type: "return", value: 42}, ...]
// Reset state
mockFn.mockClear(); // Clear call history
mockFn.mockReset(); // Clear history + implementation
Testing.suite("Suite with Hooks", () => {
beforeAll(() => {
// Run once before all tests in suite
});
afterAll(() => {
// Run once after all tests in suite
});
describe("Group", () => {
beforeEach(() => {
// Run before each test in this describe block
});
afterEach(() => {
// Run after each test in this describe block
});
it("test 1", () => { /* ... */ });
it("test 2", () => { /* ... */ });
});
});
public/{package}/{package}.test.jsprojects/{project}/tests/*.test.js**/*.test.js// Run programmatically
await Testing.run("My Suite Name");
// Run specific describe block
await Testing.runDescribe("path/to/test.js", "describe name", "suite name");
// Run specific file
await Testing.runFile("path/to/test.js");
In browser context, the test framework integrates with $APP:
// Access via $APP
$APP.Testing.run();
$APP.Testing.runFile("/tests/my.test.js");
// Or use iframe runner for isolation
Testing.iframe.run("My Suite");
Testing.iframe.runFile("/tests/my.test.js");
puppeteer (optional, for browser tests)@bootstrapp/base (optional, for browser integration)AGPL-3.0
FAQs
Test framework for Bootstrapp applications
We found that @bootstrapp/test 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
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.