Crate rest

Source
Expand description

Rest: A fluent, Jest-like testing library for Rust

This crate provides a more expressive way to write tests in Rust, inspired by JavaScript testing frameworks like Jest.

By default, assertions behave like standard Rust assertions. Enable enhanced output with:

// In your test code:
use rest::prelude::*;

fn my_test() {
    // Enable enhanced output for this test
    rest::config().enhanced_output(true).apply();
     
    expect!(2 + 2).to_equal(4);
}

Or set the REST_ENHANCED_OUTPUT=true environment variable.

Re-exports§

pub use config::initialize;
pub use crate::config::Config;

Modules§

backend
Backend module for test evaluation and result generation
config
events
frontend
Frontend module for rendering test results
matchers
Matcher traits module for bringing the traits into scope
prelude
Main prelude module containing everything needed for fluent testing

Macros§

expect
Main entry point for fluent assertions
expect_not
Shorthand for creating a negated expectation This provides a more natural way to write assertions with not
rest_test
Run all Rest tests in a module

Structs§

Reporter

Functions§

auto_initialize_for_tests
config
Creates a new test configuration

Attribute Macros§

after_all
Registers a function to be run once after all tests in the current module
before_all
Registers a function to be run once before any test in the current module
setup
Registers a function to be run before each test in the current module
tear_down
Registers a function to be run after each test in the current module
with_fixtures
Runs a function with setup and teardown fixtures from the current module
with_fixtures_module
Runs all test functions in a module with setup and teardown fixtures