From 03db40965addf76b838ccd1021fbd101105c04bc Mon Sep 17 00:00:00 2001 From: Stefan Holderbach Date: Sun, 29 May 2022 14:33:24 +0200 Subject: [PATCH] Script to gather test coverage for nushell (#234) * Script to gather test coverage for nushell Uses https://github.com/taiki-e/cargo-llvm-cov Adapted to gather integration test from https://github.com/taiki-e/cargo-llvm-cov#get-coverage-of-external-tests * Trim variable names Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com> Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com> --- make_release/get_coverage.nu | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 make_release/get_coverage.nu diff --git a/make_release/get_coverage.nu b/make_release/get_coverage.nu new file mode 100755 index 0000000..4bf1bfe --- /dev/null +++ b/make_release/get_coverage.nu @@ -0,0 +1,32 @@ +# Test coverage gathering for nushell +# Uses cargo-llvm-cov +# Uses separate execution to track the integration tests +# Hacked together by @sholderbach + +# Get test coverage for nushell +def main [ + --extra # Get coverage for extra features + ] { + cargo llvm-cov show-env --export-prefix | + lines | + str substring '7,' | + split column '=' | + str trim -c '"' | + transpose | + headers | + reject 'column1' | + get 0 | + str trim | + load-env + + cargo llvm-cov clean --workspace + if $extra { + cargo build --workspace --features extra + cargo test --workspace --features extra + } else { + cargo build --workspace + cargo test --workspace + } + cargo llvm-cov --no-run --lcov --output-path lcov.info + cargo llvm-cov --no-run --html +}