Skip to content

Commit

Permalink
fix(ci): debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
McPatate committed Nov 7, 2023
1 parent c316c3c commit b344597
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion crates/testbed/repositories-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ repositories:
build_args: ["run", "build"]
language: typescript
runner: vitest
runner_extra_args: ["--", "--no-color"]
setup_commands:
- ["npm", ["install"]]
holes_file: io-ts-smol.json
Expand Down
13 changes: 8 additions & 5 deletions crates/testbed/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{path::Path, process::Stdio};
use anyhow::anyhow;
use serde::{Deserialize, Serialize};
use tokio::{io::AsyncReadExt, process::Command};
use tracing::debug;
use tracing::{debug, info};

use crate::parse_env;

Expand Down Expand Up @@ -38,7 +38,7 @@ async fn pytest_runner(
"--no-header".to_owned(),
];
args.append(extra_args);
debug!("running pytest tests: {cmd} {args:?}");
debug!("running pytest tests: {cmd} {}", args.join(" "));
let mut child = Command::new(cmd)
.args(args)
.current_dir(repo_path)
Expand Down Expand Up @@ -103,7 +103,7 @@ async fn cargo_runner(
"--format".to_owned(),
"json".to_owned(),
]);
debug!("running cargo tests: {cmd} test {args:?}");
debug!("running cargo tests: {cmd} test {}", args.join(" "));
let parsed_env = parse_env(env)?;
let mut cmd = Command::new(cmd);
for (name, value) in parsed_env {
Expand Down Expand Up @@ -158,7 +158,7 @@ async fn jest_runner(
} else {
&default_args
};
debug!("running jest tests: {cmd} {args:?}");
debug!("running jest tests: {cmd} {}", args.join(" "));
let mut child = Command::new(cmd)
.args(args)
.current_dir(repo_path)
Expand Down Expand Up @@ -213,11 +213,12 @@ async fn vitest_runner(
} else {
&default_args
};
debug!("running vitest tests: {cmd} {}", args.join(" "));
let mut child = Command::new(cmd)
.args(args)
.current_dir(repo_path)
.stdout(Stdio::piped())
.stderr(Stdio::null())
// .stderr(Stdio::null())
.spawn()?;

let mut stdout = String::new();
Expand All @@ -227,12 +228,14 @@ async fn vitest_runner(
.ok_or(anyhow!("failed to take stdout"))?
.read_to_string(&mut stdout)
.await?;
info!("stdout: {stdout}");
let lines = stdout.split_terminator('\n');
let mut passed = 0f32;
let mut failed = 0f32;
for line in lines {
if line.contains("Tests") {
let words = line.trim().split(' ').collect::<Vec<&str>>();
info!("line containing 'Tests': {words:?}");
let mut prev = words[0];
for word in words {
if word.contains("passed") {
Expand Down

0 comments on commit b344597

Please sign in to comment.