| Crates.io | cargo-extract-test |
| lib.rs | cargo-extract-test |
| version | 0.1.1 |
| created_at | 2025-08-11 15:29:56.788333+00 |
| updated_at | 2025-08-11 15:52:19.093667+00 |
| description | A Cargo subcommand to extract and run a single test function in isolation. |
| homepage | https://github.com/zk4x/cargo-extract-test |
| repository | https://github.com/zk4x/cargo-extract-test |
| max_upload_size | |
| id | 1790345 |
| size | 12,263 |
A Cargo subcommand to extract, compile and run a single test function in isolation.
cargo-extract-test allows you to:
Extract a specific test function from your project.
Compile and run it in isolation using cargo test --test.
Quickly debug or isolate failing tests without compiling and running the entire test suite.
Option 1: Local Installation
To extract and run a specific test function:
cargo extract-test <test_function_name> [-- <cargo test args>]
For example:
cargo extract-test my_test_function -- --nocapture
This command:
Extracts my_test_function into a temporary test file.
Runs it using cargo test --test __temp_test, passing any additional arguments.
The tool searches your project's source and test directories for the specified test function.
It copies the test function and any necessary use statements into a temporary file.
It compiles and runs the test in isolation, providing immediate feedback.
walkdir: For recursively searching directories.
Given a test function:
#[cfg(test)]
mod tests {
#[test]
fn my_test_function() {
assert_eq!(2 + 2, 4);
}
}
cargo extract-test my_test_function -- --nocapture
Will extract and run my_test_function in isolation.
This project is licensed under the MIT License.