Skip to main content

Crate ferridriver_expect

Crate ferridriver_expect 

Source
Expand description

Value matchers (Jest-compatible) and asymmetric matchers for ferridriver’s expect() API. Shared between the test runner (ferridriver-test) and the QuickJS scripting layer (ferridriver-script) so both surfaces dispatch through the same Rust core (per the Rust-is-the-source-of-truth rule).

Web-first matchers (locator/page/apiResponse) still live in ferridriver-test::expect because they need the test runner’s polling + screenshot context. This crate is intentionally tiny: regex, serde, serde_json deps only.

Re-exports§

pub use asymmetric::ASYM_TAG_KEY;
pub use asymmetric::Asymmetric;
pub use asymmetric::TypeTag;
pub use asymmetric::deep_equal;
pub use asymmetric::match_object;
pub use builder::Expect;
pub use builder::ExpectPoll;
pub use builder::HaveCssOptions;
pub use builder::InViewportOptions;
pub use builder::ToPassOptions;
pub use builder::expect;
pub use builder::expect_configured;
pub use builder::expect_poll;
pub use builder::to_pass;
pub use builder::to_pass_with_options;
pub use diff::json_diff;
pub use diff::pretty_json;
pub use diff::unified_diff;
pub use poll::DEFAULT_EXPECT_TIMEOUT;
pub use poll::ExpectContext;
pub use poll::MatchError;
pub use poll::POLL_INTERVALS;
pub use poll::poll_until;
pub use throw::ExpectFn;
pub use throw::ThrowMatcher;
pub use throw::ThrownError;
pub use throw::expect_fn;
pub use value::ExpectValue;
pub use value::StringOrRegex;
pub use value::expect_value;

Modules§

api_response
expect(apiResponse).toBeOK() — synchronous status check on a captured ferridriver::http_client::HttpResponse.
asymmetric
Asymmetric matchers (expect.any, expect.objectContaining, …). Wire-encoded as a tagged JSON object so the script layer can produce them in JS and have them round-trip through serde_json::Value.
builder
Expect<T> builder shared by every consumer (test runner, QuickJS binding, plain Rust callers). Targets are subjects of web-first matchers — &Locator, &Arc<Page>, &HttpResponse. Value matchers live on crate::ExpectValue instead.
diff
Unified-diff rendering for assertion failures.
locator
Locator web-first matchers — single source of truth shared by the test runner (ferridriver-test) and the QuickJS binding (ferridriver-script). Screenshot / aria-snapshot / value-snapshot matchers stay in ferridriver-test because they pull in image and aria-YAML infrastructure that does not belong in this lightweight crate.
page
Page web-first matchers — url + title only. Snapshot/screenshot/ aria matchers live in ferridriver-test because they need the test-runner’s snapshot directory + image pipeline.
poll
Generic async polling primitives shared by the test runner’s Expect<T> and the script-layer ExpectJs binding.
throw
Synchronous toThrow matcher (Jest’s expect(fn).toThrow(...)).
value
Synchronous value matchers (Jest-style).

Structs§

AssertionFailure
Failure produced by a synchronous value matcher.
CallerLocation
Source location captured at the matcher call site. 'static strings come straight from std::panic::Location — no allocations on the happy path.