Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,3 @@ mod execute;
mod fs_util;
mod types;
pub mod which;

#[cfg(test)]
mod test;
#[cfg(test)]
mod test_builder;
2 changes: 1 addition & 1 deletion src/shell/which.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn resolve_command_path<'a>(
// using the deno as the current executable
let file_stem = exe_path.file_stem().map(|s| s.to_string_lossy());
if file_stem
.map(|s| !s.starts_with("deno_task_shell-"))
.map(|s| !s.starts_with("integration_test-"))
.unwrap_or(true)
{
return Ok(exe_path);
Expand Down
9 changes: 5 additions & 4 deletions src/shell/test.rs → tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
use std::time::Duration;
use std::time::Instant;

use deno_task_shell::ExecuteResult;
use deno_task_shell::KillSignal;
use deno_task_shell::SignalKind;
use futures::FutureExt;

use crate::KillSignal;
use crate::SignalKind;
use self::test_builder::TestBuilder;

use super::test_builder::TestBuilder;
use super::types::ExecuteResult;
mod test_builder;

const FOLDER_SEPERATOR: char = if cfg!(windows) { '\\' } else { '/' };

Expand Down
34 changes: 19 additions & 15 deletions src/shell/test_builder.rs → tests/test_builder.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
// Copyright 2018-2024 the Deno authors. MIT license.

use anyhow::Context;
use futures::future::LocalBoxFuture;
use pretty_assertions::assert_eq;
use std::collections::HashMap;
use std::ffi::OsString;
use std::fs;
use std::path::Path;
use std::path::PathBuf;
use std::rc::Rc;
use tokio::task::JoinHandle;

use crate::ShellCommand;
use crate::ShellCommandContext;
use crate::execute_with_pipes;
use crate::parser::parse;
use crate::shell::fs_util;
use crate::shell::types::KillSignal;
use crate::shell::types::ShellPipeWriter;
use crate::shell::types::ShellState;
use crate::shell::types::pipe;
use anyhow::Context;
use deno_task_shell::KillSignal;
use deno_task_shell::ShellCommand;
use deno_task_shell::ShellCommandContext;
use deno_task_shell::ShellPipeWriter;
use deno_task_shell::ShellState;
use deno_task_shell::execute_with_pipes;
use deno_task_shell::parser::parse;
use deno_task_shell::pipe;
use futures::future::LocalBoxFuture;
use pretty_assertions::assert_eq;
use tokio::task::JoinHandle;

use super::types::ExecuteResult;
use deno_task_shell::ExecuteResult;

type FnShellCommandExecute =
Box<dyn Fn(ShellCommandContext) -> LocalBoxFuture<'static, ExecuteResult>>;
Expand Down Expand Up @@ -54,7 +54,7 @@ struct TempDir {
impl TempDir {
pub fn new() -> Self {
let temp_dir = tempfile::tempdir().unwrap();
let cwd = fs_util::canonicalize_path(temp_dir.path()).unwrap();
let cwd = canonicalize_path(temp_dir.path()).unwrap();
Self {
_inner: temp_dir,
cwd,
Expand Down Expand Up @@ -297,3 +297,7 @@ fn get_output_writer_and_handle() -> (ShellPipeWriter, JoinHandle<String>) {
let handle = reader.pipe_to_string_handle();
(writer, handle)
}

fn canonicalize_path(path: &Path) -> std::io::Result<PathBuf> {
Ok(deno_path_util::strip_unc_prefix(path.canonicalize()?))
}
Loading