An alternative [phrase].
A validation rule that tests whether a subject meets specific criteria. In BUPKIS, assertions are expressed as natural language phrases combined with optional parameters. Each assertion has an implementation (schema or function) that performs the actual validation.
See also: Expectation
The internal system that processes assertion calls, parses arguments into slots, matches them against registered assertions, and executes the validation logic. BUPKIS has separate sync and async assertion engines.
An object returned by function-based assertions to indicate failure with detailed context:
type AssertionFailure = {
actual?: unknown;
expected?: unknown;
message?: string;
};
A unique identifier automatically generated for each assertion based on its parts. Used internally for assertion matching and in property test configurations. Example: 'string-to-contain-string-3s1p'
.
The logic that performs the actual validation for an assertion. Can be either a Zod schema or a function that returns a boolean, void, Zod schema, or AssertionFailure object.
The raw definition of an assertion's structure, including phrases and Zod schemas. Example: [z.string(), 'to contain', z.string()]
. These are converted into slots for runtime processing.
The standard Node.js error thrown when an assertion fails. BUPKIS uses this for compatibility with testing frameworks.
An assertion designed to work with Promises and async operations. Created using createAsyncAssertion()
and used with expectAsync()
. Examples include 'to resolve'
and 'to reject'
.
A statement about what should be true about a value or behavior. This term is used interchangeably with "assertion" in the context of BUPKIS. For example, "I expect this value to be a string" expresses the same concept as "I assert this value is a string."
See also: Assertion
The primary function for making synchronous assertions. Takes a subject and assertion arguments: expect(value, 'to be a string')
. Cannot be used with custom assertions directly - must use the result of expect.use()
.
The function for making asynchronous assertions with Promises. Returns a Promise that resolves if the assertion passes or rejects if it fails.
An assertion implemented using a JavaScript function rather than a Zod schema. The function receives the subject and any parameters, and can return various types to indicate success or failure.
BUPKIS's approach to assertion syntax that uses human-readable phrases instead of method chaining. For example, expect(value, 'to be greater than', 5)
instead of expect(value).toBeGreaterThan(5)
.
The ability to invert an assertion using 'not'
. For example, expect(5, 'not to be a string')
. BUPKIS automatically supports negation for all assertions.
Additional values passed to parameterized assertions. In expect(10, 'to be greater than', 5)
, the value 5
is a parameter. Parameters are validated against Zod schemas defined in the assertion parts.
An assertion that accepts additional parameters beyond the subject. These assertions have variable behavior based on the parameters provided. Example: 'to be greater than'
requires a number parameter.
A string literal that forms part of an assertion's natural language expression. Phrases are the human-readable parts between parameters. In [z.string(), 'to contain', z.string()]
, 'to contain'
is a phrase.
The internal representation of a phrase as a branded Zod literal type. Used in the type system to ensure compile-time validation of assertion usage.
An assertion implemented using a Zod schema directly. The schema defines both the validation logic and error handling. This is the recommended approach for most assertions.
The processed representation of assertion parts used for runtime argument matching. Slots are derived from assertion parts by converting phrases to Zod literals and keeping Zod schemas as-is.
An assertion that tests the current state or properties of a value, as opposed to testing behavior. Examples include type checks ('to be a string'
) and value comparisons ('to equal'
).
The first argument to expect()
- the value being tested. In expect(42, 'to be a number')
, the subject is 42
. The subject is what the assertion validates against.
An assertion that completes immediately without waiting for Promises or async operations. Used with the standard expect()
function. Most built-in assertions are synchronous.
The method for registering custom assertions with BUPKIS. Called as expect.use([customAssertions])
and returns new expect
and expectAsync
functions that include the custom assertions.
A validation schema from the Zod library used to define assertion implementations and parameter types. BUPKIS is built around Zod v4 and uses schemas extensively for both validation and type inference.