Minecraft-Specific Matchers
toHaveReceivedMessage(message, options?)
Waits for the bot to receive a message containing (or exactly matching) the text or RegExp.
message(string | RegExp) - Text or pattern to search foroptions.strict(boolean) - Require exact match (default: false)options.since(number) - Buffer index to search fromoptions.timeout(number) - Max wait time in ms
toContainItem(itemName)
Waits for the player’s inventory to contain an item with the specified name.
itemName(string) - Minecraft item name (e.g., ‘diamond’, ‘stone_sword’)
toHaveLore(text, options?)
Asserts that a GUI item locator contains specific lore text, with automatic retry.
text(string) - Text that should appear in loreoptions.timeout(number) - Max wait time in ms (default: 5000)options.pollingRate(number) - Check interval in ms (default: 100)
Basic Equality
toBe(value)
Strict equality check using Object.is(). Use for primitives.
toEqual(value)
Deep equality check. Use for objects and arrays.
Truthiness
toBeTruthy() / toBeFalsy()
toBeNull() / toBeUndefined() / toBeDefined()
toBeNaN()
Numbers
toBeGreaterThan(number) / toBeGreaterThanOrEqual(number)
toBeLessThan(number) / toBeLessThanOrEqual(number)
toBeCloseTo(number, precision?)
Floating-point comparison with precision (default: 2 decimal places).
Strings
toMatch(regexOrString)
toContain(substring)
Works on both strings and arrays.
Arrays and Collections
toContainEqual(item)
Deep equality check for array items.
toHaveLength(number)
Objects
toHaveProperty(keyPath, value?)
toMatchObject(object)
Subset matching for objects.
Exceptions
toThrow(expected?)
toThrowAsync(expected?)
Async version for async functions.
Types
toBeInstanceOf(class)
Negation
All matchers support.not:
Tips
- Use appropriate matchers:
toBe()for primitives,toEqual()for objects/arrays - Async matchers must be awaited:
toHaveReceivedMessage,toContainItem,toHaveLore,toThrowAsync - Use the most specific matcher for your use case — it produces clearer failure messages
- All matchers support
.notfor negation - Minecraft matchers have a 5-second default timeout