Watches changes in a rust project, runs test and shows friendly notification

Overview

Cargo testify

Build Status License

Automatically runs tests on your Rust project and notifies about the result.

rust test with notification

Install

Install prerequisites (for Debian/Ubuntu):

apt-get install -y libdbus-1-dev

Install the crate:

cargo install cargo-testify

Usage

Run within your Rust project:

cargo testify

How does it work?

It watches changes in the project directory, and reacts by running cargo test. The output result is parsed to identify one of the possible outcomes:

  • Tests passed
  • Tests failed
  • Compilation failed

To display notification in the Desktop environment notify-send (Linux) or osascript (MacOS) commands are used.

Watched files

  • src/**/*.rs
  • tests/**/*.rs
  • Cargo.toml
  • Cargo.lock
  • build.rs

Bypassing options to cargo test

Run cargo test --lib on file change:

cargo testify -- --lib

License

MIT © Sergey Potapov

Contributors

  • greyblake Potapov Sergey - creator, maintainer.
  • hoodie Hendrik Sollich - thanks for notify-rust crate
  • waywardmonkeys Bruce Mitchener - fix typos
  • Hugal31 - support of --include option
  • barskern Ole Martin Ruud - migrate from clap to structopt
Comments
  • notifications without shelling out

    notifications without shelling out

    Hi there, awesome tool. I saw that you check for local tools like notify-send and osascript to produce notifications. There is actually already a crate for that :D This is what it would look like.

    cheers

    opened by hoodie 5
  • Add ignore pattern

    Add ignore pattern

    I often work with emacs, and this app reacts to the creation of temporary files like .#lib.rs, or lib.rs~.

    It would be nice to only look for modification of not-hidden *.rs files inside src and tests directories, or make it configurable, maybe with regex or glob patterns.

    opened by Hugal31 4
  • Add glob matching

    Add glob matching

    Tracking issue: #7

    • Add glob matching with defaults patterns:
      • Cargo.toml
      • Cargo.lock
      • src/**/*.rs
      • tests/**/*.rs
      • build.rs
    • Add --include option to add custom patterns.
    opened by Hugal31 3
  • build fails on nightly rust, ubuntu 20.04

    build fails on nightly rust, ubuntu 20.04

    error: failed to run custom build command for `libdbus-sys v0.2.1`
    
    Caused by:
      process didn't exit successfully: `/tmp/cargo-installU1WHBF/release/build/libdbus-sys-35ee7a2ded76b9a6/build-script-build` (exit status: 101)
      --- stdout
      cargo:rerun-if-env-changed=DBUS_1_NO_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG
      cargo:rerun-if-env-changed=DBUS_1_STATIC
      cargo:rerun-if-env-changed=DBUS_1_DYNAMIC
      cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
      cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
    
      --- stderr
      thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failure { command: "\"pkg-config\" \"--libs\" \"--cflags\" \"dbus-1\" \"dbus-1 >= 1.6\"", output: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "Package dbus-1 was not found in the pkg-config search path.\nPerhaps you should add the directory containing `dbus-1.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'dbus-1' found\nPackage dbus-1 was not found in the pkg-config search path.\nPerhaps you should add the directory containing `dbus-1.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'dbus-1' found\n" } }', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/libdbus-sys-0.2.1/build.rs:6:70
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    warning: build failed, waiting for other jobs to finish...
    error: failed to compile `cargo-testify v0.3.0`, intermediate artifacts can be found at `/tmp/cargo-installU1WHBF`
    
    opened by zesty 1
  • Migrate from clap to structopt

    Migrate from clap to structopt

    Structopt provides custom derives to parse the commandline arguments into a config struct, hence it abstracts away a lot of parsing, which makes the code less verbose.

    Moving to structopt makes the config and error modules obsolete.

    Further this PR also currently removes the tests which were located in reactor.rs, because the removal of the config module removes components used in those tests. Further the tests were testing a small wrapper around the glob-crate, hence they might not be incredibly useful. These tests can be recreated to fit into the new structure if you want them back.

    opened by barskern 1
  • Proposal: Moving from clap to structopt

    Proposal: Moving from clap to structopt

    Since this library is using clap directly, the definition of the arguments and subcommands is IMO verbose. Further one has to manually convert the hashmap of arguments into their respective types. Hence I was thinking about rewriting the CLI relevant code to rather use structopt instead.

    Before doing this I was wondering if this is something that you see as relevant, or if it is a reason behind using clap directly?


    structopt - This crate allows you to define a struct, and build a CLI from it! No more "stringly typed" and it uses clap behind the scenes! (Note: There is work underway to pull this crate into mainline clap). -- README.md of clap

    There is a process ongoing which will make the structopt-way of defining arguments possible directly in clap, hence it seems as though the community is moving towards a singular way of defining arguments. When this change happens, it will probably be easy to migrate back to clap, using the new structopt code.

    opened by barskern 1
Owner
Sergey Potapov
The random dude from the Internet.
Sergey Potapov
client-server notification center for dbus desktop notifications

tsuchita A client-server notification center for dbus desktop notifications. Specifically org.freedesktop.Notifications dbus messages. Motivation I ju

Jeff Zhao 7 Oct 9, 2022
A tool for investigating file system and folder contents and their changes.

Sniff A tool for investigating file systems and folder contents and their changes. Sniff can create snapshots of file systems and folders, storing has

Niclas Schwarzlose 6 Jan 14, 2023
Tool written in rust to read for file changes and accordingly run build commands.

Sniff A simple tool written in rust to read for file changes and accordingly run build commands. Note this tool is for linux and linux only. If it hap

Aakash Sen Sharma 4 Oct 2, 2022
💫 Small microservice to handle state changes of Kubernetes pods and post them to Instatus or Statuspages

?? Kanata Small microservice to handle state changes of Kubernetes pods and post to Instatus ?? Why? I don't really want to implement and repeat code

Noel ʕ •ᴥ•ʔ 4 Mar 4, 2022
Generate commit messages using GPT3 based on your changes and commit history.

Commit Generate commit messages using GPT-3 based on your changes and commit history. Install You need Rust and Cargo installed on your machine. See t

Brian Le 40 Jan 3, 2023
Rust program to monitor Windows 10 Registry keys for changes or modifications.

RegMon This Rust program monitors changes to multiple registry keys in Windows 10 and writes the changes to a text file. It also periodically sends a

0x44F 3 Jan 16, 2023
messloc is a drop in replacement for malloc that can transparently recover from memory fragmentation without any changes to application code.

messloc is a drop in replacement for malloc that can transparently recover from memory fragmentation without any changes to application code. Goals Al

null 11 Dec 10, 2022
BSV stdlib written in Rust and runs in WASM environments

BSV.WASM A Rust/WASM Library to interact with Bitcoin SV Installation NodeJS: npm i bsv-wasm --save Web: npm i bsv-wasm-web --save Rust: https://crate

null 56 Dec 15, 2022
Sampling profiler and tracer for Ruby (CRuby) which runs in BPF

rbperf rbperf is a low-overhead sampling profiler and tracer for Ruby (CRuby) which runs in BPF Build To build rbperf you would need a Linux machine w

Javier Honduvilla Coto 75 Dec 19, 2022
A thin-hypervisor that runs on aarch64 CPUs.

How to build the hypervisor By Rust toolchain (TBD) By docker Requirements Docker (Tested by Docker version 20.10.8, build 3967b7d28e) I tested by non

RIKEN R-CCS 54 Dec 12, 2022
Creates a DLL that runs a payload once injected into a process.

Educational purposes only Don't use this project maliciously. Prerequisites Install rust Install windows toolchain Setup Run cargo run --bin builder -

RadonCoding 3 Aug 27, 2022
Rust Util Collection, a simple and friendly error-chain

RUC Rust Util Collection, a simple and friendly error-chain, with many useful utils as an addition. The painful experience of using error-chain gave b

漢 8 Dec 8, 2022
Rust Util Collection, a simple and friendly error-chain, with many useful utils as an addition.

RUC Rust Util Collection, a simple and friendly error-chain, with many useful utils as an addition. The painful experience of using error-chain gave b

漢 6 Mar 27, 2022
A strict, yet friendly mocking library for Rust 2018

Mockiato A strict, yet friendly mocking library for Rust 2018 ⚠️ Disclaimer for working with stable rust Mockiato relies on the unstable proc_macro_di

Mockiato 228 Dec 30, 2022
🐦 Friendly little instrumentation profiler for Rust 🦀

?? puffin The friendly little instrumentation profiler for Rust How to use fn my_function() { puffin::profile_function!(); ... if ... {

Embark 848 Dec 29, 2022
Wait Service is a pure rust program to test and wait on the availability of a service.

Wait Service Wait Service is a pure rust program to test and wait on the availability of a service.

Magic Len (Ron Li) 3 Jan 18, 2022
Transmute - a binary that works alone or in coordination with coverage formatter to report test quality

Transmute is a binary that works alone or in coordination with coverage formatter to report test quality. It will change your code and make the tests fail. If don't, we will raise it for you.

Victor Antoniazzi 5 Nov 17, 2022
A Rust framework to develop and use plugins within your project, without worrying about the low-level details.

VPlugin: A plugin framework for Rust. Website | Issues | Documentation VPlugin is a Rust framework to develop and use plugins on applications and libr

VPlugin 11 Dec 31, 2022
Forked rust translation of the popular dump1090 project for adsb demodulation

Forked rust translation of the popular dump1090 project for adsb demodulation

wcampbell 64 Dec 24, 2022