One Runner to Rule Them All
A polyglot testing framework that adds specialized dialects to existing test suites without requiring rewrites. Zero-risk adoption with Jest compatibility.
Features β’ Installation β’ Quick Start β’ Dialects β’ Documentation
- Zero Risk Adoption: Your legacy code continues working unchanged
- Polyglot Approach: Multiple specialized dialects for different domains
- Jest Compatible: Runs alongside existing Jest tests in the same suite
- Four Specialized Dialects:
- π Mathematical: For algorithms, calculations, and mathematical proofs
- π Narrative: For business rules readable by product managers
- π‘οΈ Imperative: For API contracts and integration testing
- π API Testing: For declarative API contract validation
npm install @purecore/one-proof-4-allCreate a test file api.spec.ts:
import { ensure, check, that, stub } from "@purecore/one-proof-4-all";
ensure("My User API", () => {
const api = stub();
api.forceReturn({ status: 200, id: "user_123" });
check("User creation returns 200 OK", () => {
const response = api.createUser({ name: "John" });
that(response.status).is(200);
that(response.id).matches(/^user_\w+$/);
});
});Run your tests:
npx one-proof-4-all
# or aliases:
npx os4all
npx 1spec
npx testallYou don't need to learn all four. Choose what fits your domain:
βββββββββββββββββββββββββββββββββββββββββββ
β What are you testing? β
βββββββββββββββββββββ¬ββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββββββββββββββ ββββββββββββββββββββββββ ββββββββββββββββββββββββ
β Pure algorithms, β β User flows, business β β APIs, contracts, β
β calculations, β β rules readable by β β integrations, β
β mathematical rules? β β product managers? β β compliance? β
ββββββββββββ¬ββββββββββββ ββββββββββββ¬ββββββββββββ ββββββββββββ¬ββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββββββββββββββ ββββββββββββββββββββββββ ββββββββββββββββββββββββ
β π MATHEMATICAL β β π NARRATIVE β β π‘οΈ IMPERATIVE β
β axiom, proof, impliesβ β intend, scenario, to β β ensure, check, that β
ββββββββββββββββββββββββ ββββββββββββββββββββββββ ββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββ
β Backend services, QA teams? β
βββββββββββββββ¬βββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββ
β π API TESTING β
β ApiSpec.define().post() β
ββββββββββββββββββββββββββββββββ
Perfect for scientists and mathematicians proving pure functions.
import { axiom, proof, implies } from "@purecore/one-proof-4-all";
axiom("SHA-256 Hash Theory", () => {
proof("Empty string hash converges to known constant", () => {
implies(sha256("")).is("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
});
proof("Hash is deterministic", () => {
const input = "hello world";
implies(sha256(input)).is(sha256(input));
});
});axiom(name, fn)- Group of truthsproof(name, fn)- Individual proofimplies(val).is(x)- Logical implicationarbitrary()- Generic functionpostulate(fn)- Global premisesgiven(fn)- "Given that..."
Designed for teams with product managers who need to validate business rules.
import { intend, scenario, to, standIn } from "@purecore/one-proof-4-all";
intend("User Permission Journey", () => {
const userService = standIn();
background(() => {
userService.setup({
permissions: ["read", "write"]
});
});
scenario("Unauthorized user tries to access admin panel", () => {
const response = userService.accessAdminPanel("guest_user");
to(response.status).be(403);
to(response.message).be("Access denied");
});
scenario("Authorized user accesses dashboard", () => {
const response = userService.accessDashboard("admin_user");
to(response.status).be(200);
to(response.data).toBeDefined();
});
});intend(name, fn)/story(name, fn)- Intent/storyscenario(name, fn)/detail(name, fn)- Scenarioto(val).be(x)- ExpectationstandIn()/dummy()- Stand-inbackground(fn)- Contextbefore(fn)- Before each scene
For backend developers testing API contracts and integrations.
import { ensure, verify, that, stub, initAll, reset } from "@purecore/one-proof-4-all";
let api;
initAll(() => {
api = stub();
});
reset(() => {
api.reset();
});
ensure("PCI-DSS Gateway Compliance v4", () => {
verify("Sensitive data never travels in plain text", () => {
const payload = api.processPayment({ card: "1234" });
that(payload).matches(/^encrypted:/);
});
verify("All transactions are logged", () => {
api.processTransaction({ amount: 100 });
that(api.getTransactionLog()).toHaveLength(1);
});
});ensure(name, fn)- Ensure a requirementcheck(name, fn)/verify(name, fn)- Point checkthat(val).is(x)- Assertionstub()/mock()- Create mockinitAll(fn)- Initial setupreset(fn)- Reset per testspy()- Monitor callsdisposeAll(fn)- Cleanup
Specialized for backend services and QA teams testing microservices.
import { ApiSpec } from "@purecore/one-proof-4-all";
const userSchema = {
type: "object",
properties: {
id: { type: "string" },
name: { type: "string" },
email: { type: "string", format: "email" }
},
required: ["id", "name", "email"]
};
await ApiSpec.define("Create User")
.from("https://api.example.com")
.post("/users", {
name: "John Doe",
email: "john@example.com"
})
.shouldReturn(201)
.matchingSchema(userSchema)
.run();
await ApiSpec.define("Get User")
.from("https://api.example.com")
.get("/users/user_123")
.shouldReturn(200)
.matchingSchema(userSchema)
.run();ApiSpec.define(name)- Define the test.from(url)- Set base URL.get()/.post()/.put()/.delete()- HTTP actions.shouldReturn(code)- Status validation.matchingSchema(schema)- Contract validation.withHeaders(headers)- Set headers.withAuth(token)- Authentication.timeout(ms)- Set timeout
- Create a file ending in
.spec.ts(e.g.,api.spec.ts) - Import the dialect:
import { ApiSpec } from "@purecore/one-proof-4-all";
- Define and run your test (supports Top-Level Await):
await ApiSpec.define("Health Check") .from("http://localhost:3000") .get("/health") .shouldReturn(200) .run();
- Execute using the CLI:
npx one-proof-4-all # or with bun bun run os4all
Using multiple dialects in the same project:
// π MATHEMATICAL: Price calculations (pure logic)
import { axiom, proof, implies } from "@purecore/one-proof-4-all";
axiom("Price Calculation Theory", () => {
proof("10% discount on $100 equals $90", () => {
implies(calcDiscount(100, 10)).is(90);
});
proof("Tax calculation is additive", () => {
const base = 100;
const discounted = calcDiscount(base, 10);
const withTax = addTax(discounted, 5);
implies(withTax).is(94.5);
});
});
// π NARRATIVE: User journey (PM readable)
import { intend, scenario, to } from "@purecore/one-proof-4-all";
intend("User Shopping Journey", () => {
scenario("User adds product to cart", () => {
const cart = shoppingCart.addProduct(product);
to(cart.items).toHaveLength(1);
to(cart.total).be(29.99);
});
scenario("User applies coupon code", () => {
const cart = shoppingCart.applyCoupon("SAVE10");
to(cart.discount).be(10);
to(cart.finalTotal).be(26.99);
});
});
// π‘οΈ IMPERATIVE: Payment gateway integration (strict contract)
import { ensure, check, that } from "@purecore/one-proof-4-all";
ensure("Payment Gateway v2.1 Compliance", () => {
check("Transaction returns status 200", () => {
const response = paymentGateway.process({
amount: 26.99,
card: "**** **** **** 1234"
});
that(response.status).is(200);
that(response.transactionId).matches(/^txn_[a-zA-Z0-9]+$/);
});
check("Failed transactions return proper error codes", () => {
const response = paymentGateway.process({
amount: 26.99,
card: "invalid_card"
});
that(response.status).is(400);
that(response.errorCode).is("INVALID_CARD");
});
});- π Quick Start Guide - Comprehensive getting started guide
- π Whitepaper - Detailed technical overview and philosophy
- π‘ 4 Ideas Document - Original concept ideas
- π Mathematical Dialect API
- π Narrative Dialect API
- π‘οΈ Imperative Dialect API
- π API Testing Dialect API
- π Mathematical Example
- π Narrative Example
- π‘οΈ Imperative Example
- π Polyglot Shopping Cart
- π§ͺ Sanity Tests
- π API Testing Example
- π API Showcase (All features)
Your existing Jest tests continue working unchanged:
// β
Your legacy Jest code - UNTOUCHED
describe("Login Module (Legacy)", () => {
it("should validate password", () => {
expect(validate("123")).toBe(true);
});
});
// β
New feature with new dialect - COMPLEMENTARY
import { axiom, implies } from "@purecore/one-proof-4-all";
axiom("New SHA-256 Cryptography", () => {
implies(hash("123")).matches(/^[a-f0-9]{64}$/);
});Single npm test command runs both. Same report. Same coverage. No rewrite needed.
| Problem | Solution with one-proof-4-all |
|---|---|
| PMs can't read tests | Narrative dialect produces readable specifications |
| Meetings to validate rules | Tests become approvable documentation |
| Ambiguity between product and engineering | Common language eliminates rework |
Result: Fewer meetings, shorter validation cycles, fewer bugs reaching production.
| Situation | Benefit |
|---|---|
| Onboarding data scientists | Learn only MathDialect, not entire ecosystem |
| Backend devs focused | Use only ImperativeDialect for contracts |
| Domain specialization | Each member produces more, faster |
Result: Training in days, not weeks. Immediate contribution.
| Fear | Reality |
|---|---|
| "I'll have to rewrite 5,000 tests" | β False. Jest runs natively |
| "Another dependency to maintain" | Incremental integration, not big-bang |
| "What if it fails mid-project?" | Adopt in 1 new file. Evaluate. Expand if liked |
Result: Immediate improvement without technical debt. Trivial rollback if needed.
# Run all specs
npx one-proof-4-all
# Watch mode
npx one-proof-4-all --watch
# Specific file
npx one-proof-4-all src/**/*.spec.ts
# With coverage
npx one-proof-4-all --coverage@purecore/one-proof-4-all/
βββ src/
β βββ index.ts # Main entry point
β βββ cli.ts # CLI runner
βββ docs/ # Documentation
βββ examples/ # Example specifications
βββ packages/
β βββ api-test-dialect/ # API testing package
β βββ reqify/ # HTTP utilities
βββ types/
βββ api-types.ts # TypeScript definitions
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Cogfulness Ethical License (CEL) v1.0
- Inspired by the need for domain-specific testing languages
- Built with β€οΈ for diverse development teams
- Special thanks to all contributors and early adopters
Made with β€οΈ by suissAI
