Crates.io | test-env-helpers |
lib.rs | test-env-helpers |
version | 0.2.2 |
source | src |
created_at | 2022-03-08 02:15:15.203171 |
updated_at | 2022-03-22 05:11:09.815157 |
description | Jest style setup and teardown test helper macros |
homepage | https://docs.rs/test-env-helpers/latest/test_env_helpers/ |
repository | https://github.com/TomPridham/test-env-helpers |
max_upload_size | |
id | 545396 |
size | 28,730 |
Jest style setup and teardown test helpers.
#[after_all]
: Only valid on a mod
. Requires a single function named after_all
. Counts the number of functions with a test
attribute applied and runs the body of the after_all
function after all the tests have run.
#[after_each]
: Only valid on a mod
. Requires a single function named after_each
. Copies the body contents of the after_each
function into the end of the function body of any functions in the same mod
that have a test
attribute applied.
#[before_all]
: Only valid on a mod
. Requires a single function named before_all
. Runs the contents of before_all
exactly once before any tests have run.
#[before_each]
: Only valid on a mod
. Requires a single function named before_each
. Copies the body contents of the before_each
function into the beginning of the function body of any functions in the same mod
that have test
attribute applied.
test
attribute applied is any function with an attribute with the word test
in it. So, #[test]
, #[tokio::test]
, and #[test_case(blah)]
will all count for the before/after hooks.#[skip]
: Valid on a mod
or an individual test. Will skip the mod or test it is applied on.
#[only]
: Not sure how to implement this one, tbh.