Skip to content

Commit 8ed9296

Browse files
committed
refactor: extract out integration tests
1 parent 73034ad commit 8ed9296

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

src/shell/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,3 @@ mod execute;
2424
mod fs_util;
2525
mod types;
2626
pub mod which;
27-
28-
#[cfg(test)]
29-
mod test;
30-
#[cfg(test)]
31-
mod test_builder;

src/shell/which.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn resolve_command_path<'a>(
6565
// using the deno as the current executable
6666
let file_stem = exe_path.file_stem().map(|s| s.to_string_lossy());
6767
if file_stem
68-
.map(|s| !s.starts_with("deno_task_shell-"))
68+
.map(|s| !s.starts_with("integration_test-"))
6969
.unwrap_or(true)
7070
{
7171
return Ok(exe_path);
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ use std::time::Duration;
44
use std::time::Instant;
55

66
use futures::FutureExt;
7+
use deno_task_shell::KillSignal;
8+
use deno_task_shell::SignalKind;
9+
use deno_task_shell::ExecuteResult;
710

8-
use crate::KillSignal;
9-
use crate::SignalKind;
11+
use self::test_builder::TestBuilder;
1012

11-
use super::test_builder::TestBuilder;
12-
use super::types::ExecuteResult;
13+
mod test_builder;
1314

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

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
// Copyright 2018-2024 the Deno authors. MIT license.
22

3-
use anyhow::Context;
4-
use futures::future::LocalBoxFuture;
5-
use pretty_assertions::assert_eq;
63
use std::collections::HashMap;
74
use std::ffi::OsString;
85
use std::fs;
6+
use std::path::Path;
97
use std::path::PathBuf;
108
use std::rc::Rc;
11-
use tokio::task::JoinHandle;
129

13-
use crate::ShellCommand;
14-
use crate::ShellCommandContext;
15-
use crate::execute_with_pipes;
16-
use crate::parser::parse;
17-
use crate::shell::fs_util;
18-
use crate::shell::types::KillSignal;
19-
use crate::shell::types::ShellPipeWriter;
20-
use crate::shell::types::ShellState;
21-
use crate::shell::types::pipe;
10+
use anyhow::Context;
11+
use futures::future::LocalBoxFuture;
12+
use pretty_assertions::assert_eq;
13+
use deno_task_shell::ShellCommand;
14+
use tokio::task::JoinHandle;
15+
use deno_task_shell::ShellCommandContext;
16+
use deno_task_shell::execute_with_pipes;
17+
use deno_task_shell::parser::parse;
18+
use deno_task_shell::KillSignal;
19+
use deno_task_shell::ShellPipeWriter;
20+
use deno_task_shell::ShellState;
21+
use deno_task_shell::pipe;
2222

23-
use super::types::ExecuteResult;
23+
use deno_task_shell::ExecuteResult;
2424

2525
type FnShellCommandExecute =
2626
Box<dyn Fn(ShellCommandContext) -> LocalBoxFuture<'static, ExecuteResult>>;
@@ -54,7 +54,7 @@ struct TempDir {
5454
impl TempDir {
5555
pub fn new() -> Self {
5656
let temp_dir = tempfile::tempdir().unwrap();
57-
let cwd = fs_util::canonicalize_path(temp_dir.path()).unwrap();
57+
let cwd = canonicalize_path(temp_dir.path()).unwrap();
5858
Self {
5959
_inner: temp_dir,
6060
cwd,
@@ -297,3 +297,7 @@ fn get_output_writer_and_handle() -> (ShellPipeWriter, JoinHandle<String>) {
297297
let handle = reader.pipe_to_string_handle();
298298
(writer, handle)
299299
}
300+
301+
fn canonicalize_path(path: &Path) -> std::io::Result<PathBuf> {
302+
Ok(deno_path_util::strip_unc_prefix(path.canonicalize()?))
303+
}

0 commit comments

Comments
 (0)