CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-jest-expect-message

Add custom message to Jest expects

Overall
score

99%

Overview
Eval results
Files

task.mdevals/scenario-2/

Enhanced Test Assertions

Configure a Jest test suite to support custom error messages in assertions across all test files.

Requirements

Configure your Jest test environment to enable custom error messages for all assertions. The configuration should:

  1. Enable custom messages globally so they work in all test files without additional imports
  2. Allow assertions to accept a second parameter for custom error messages
  3. Display custom messages when assertions fail

Create a simple setup file that configures this enhancement.

Dependencies { .dependencies }

jest-expect-message { .dependency }

Provides assertion enhancements with custom error messages.

Implementation

@generates

API

// This file imports and initializes the required library
// to enable enhanced assertions globally

Test Cases

  • Custom messages work with basic matchers like toBe @test
  • Custom messages work with negated matchers like not.toBe @test
  • Failed assertions display the custom error message @test

Install with Tessl CLI

npx tessl i tessl/npm-jest-expect-message

tile.json