Skip to content

Commit

Permalink
tests: Add tests and increase code coverage. (#160)
Browse files Browse the repository at this point in the history
* Add node tests.

* Improve capture.

* Comment out unused code.

* Use a sandbox.

* Add package tests.

* Ignore error files.

* Add tsconfig tests.

* Test validation.

* Cleanup.

* Undo ignore.

* Test corepack an yarn3.

* Set pipefail.

* Test outputs.

* Try something.

* Disable yarn.

* Disable test.
  • Loading branch information
milesj committed Jun 27, 2022
1 parent 36ad387 commit 2e79637
Show file tree
Hide file tree
Showing 48 changed files with 1,239 additions and 106 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ jobs:
# Windows fails to compile right now...
- name: Generate code coverage
if: ${{ matrix.os != 'windows-latest' }}
run:
grcov . -s ./crates --binary-path ./target/debug -t lcov --branch --ignore-not-existing -o
./report.txt
run: |
grcov . -s ./crates --binary-path ./target/debug -t lcov --branch --ignore-not-existing -o ./report.txt
- uses: actions/upload-artifact@v2
if: ${{ matrix.os != 'windows-latest' }}
name: Upload coverage report
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ run_task = { name = ["build", "test"] }

[tasks.generate-report]
command = "grcov"
args = [".", "-s", "./crates", "--binary-path", "./target/debug", "-t", "lcov", "--branch", "--ignore-not-existing", "-o", "./report.txt"]
args = [".", "-s", "./crates", "--binary-path", "./target/debug", "-t", "lcov", "--branch", "--ignore-not-existing", "--ignore", "**/errors.rs", "--ignore", "error/src/lib.rs", "-o", "./report.txt"]

[tasks.generate-html]
command = "grcov"
args = [".", "-s", "./crates", "--binary-path", "./target/debug", "-t", "html", "--branch", "--ignore-not-existing", "-o", "./coverage"]
args = [".", "-s", "./crates", "--binary-path", "./target/debug", "-t", "html", "--branch", "--ignore-not-existing", "--ignore", "**/errors.rs", "--ignore", "error/src/lib.rs", "-o", "./coverage"]

[tasks.clean-profraw]
script = "rm -rf *.profraw"
Expand Down
1 change: 0 additions & 1 deletion crates/cache/src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use std::time::SystemTime;

const LOG_TARGET: &str = "moon:cache:item";

#[derive(Debug)]
pub struct CacheItem<T: DeserializeOwned + Serialize> {
pub item: T,

Expand Down
3 changes: 1 addition & 2 deletions crates/cli/src/commands/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use itertools::Itertools;
use moon_logger::{color, debug};
use moon_project::{Target, TouchedFilePaths};
use moon_terminal::helpers::{replace_style_tokens, safe_exit};
use moon_terminal::output;
use moon_utils::{is_ci, path, time};
use moon_workspace::DepGraph;
use moon_workspace::{ActionRunner, ActionStatus, Workspace, WorkspaceError};
Expand Down Expand Up @@ -236,7 +235,7 @@ pub async fn ci(options: CiOptions) -> Result<(), Box<dyn std::error::Error>> {
term.write_line(&format!(
"{} {} {}",
status,
output::bold(result.label.as_ref().unwrap()),
color::style(result.label.as_ref().unwrap()).bold(),
color::muted(&format!("({})", meta.join(", ")))
))?;

Expand Down
Loading

0 comments on commit 2e79637

Please sign in to comment.