1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

chore: maybe fix cli/standalone/virtual_fs tests on main (#19295)

Not sure why these don't fail on a PR run:
https://github.com/denoland/deno/actions/runs/5102317156/jobs/9171796164

**Merge on approval**
This commit is contained in:
David Sherret 2023-05-28 09:55:30 -04:00 committed by GitHub
parent d43e75cbb2
commit 92080ff6f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -848,7 +848,10 @@ mod test {
#[test] #[test]
fn builds_and_uses_virtual_fs() { fn builds_and_uses_virtual_fs() {
let temp_dir = TempDir::new(); let temp_dir = TempDir::new();
let src_path = temp_dir.path().join("src"); // we canonicalize the temp directory because the vfs builder
// will canonicalize the root path
let temp_dir_path = canonicalize_path(temp_dir.path()).unwrap();
let src_path = temp_dir_path.join("src");
temp_dir.create_dir_all(&src_path); temp_dir.create_dir_all(&src_path);
let mut builder = VfsBuilder::new(src_path.clone()).unwrap(); let mut builder = VfsBuilder::new(src_path.clone()).unwrap();
builder builder
@ -919,18 +922,19 @@ mod test {
#[test] #[test]
fn test_include_dir_recursive() { fn test_include_dir_recursive() {
let temp_dir = TempDir::new(); let temp_dir = TempDir::new();
let temp_dir_path = canonicalize_path(temp_dir.path()).unwrap();
temp_dir.create_dir_all("src/nested/sub_dir"); temp_dir.create_dir_all("src/nested/sub_dir");
temp_dir.write("src/a.txt", "data"); temp_dir.write("src/a.txt", "data");
temp_dir.write("src/b.txt", "data"); temp_dir.write("src/b.txt", "data");
util::fs::symlink_dir( util::fs::symlink_dir(
&temp_dir.path().join("src/nested/sub_dir"), &temp_dir_path.join("src/nested/sub_dir"),
&temp_dir.path().join("src/sub_dir_link"), &temp_dir_path.join("src/sub_dir_link"),
) )
.unwrap(); .unwrap();
temp_dir.write("src/nested/sub_dir/c.txt", "c"); temp_dir.write("src/nested/sub_dir/c.txt", "c");
// build and create the virtual fs // build and create the virtual fs
let src_path = temp_dir.path().join("src"); let src_path = temp_dir_path.join("src");
let mut builder = VfsBuilder::new(src_path.clone()).unwrap(); let mut builder = VfsBuilder::new(src_path.clone()).unwrap();
builder.add_dir_recursive(&src_path).unwrap(); builder.add_dir_recursive(&src_path).unwrap();
let (dest_path, virtual_fs) = into_virtual_fs(builder, &temp_dir); let (dest_path, virtual_fs) = into_virtual_fs(builder, &temp_dir);
@ -994,7 +998,8 @@ mod test {
#[test] #[test]
fn circular_symlink() { fn circular_symlink() {
let temp_dir = TempDir::new(); let temp_dir = TempDir::new();
let src_path = temp_dir.path().join("src"); let temp_dir_path = canonicalize_path(temp_dir.path()).unwrap();
let src_path = temp_dir_path.join("src");
temp_dir.create_dir_all(&src_path); temp_dir.create_dir_all(&src_path);
let mut builder = VfsBuilder::new(src_path.clone()).unwrap(); let mut builder = VfsBuilder::new(src_path.clone()).unwrap();
builder builder
@ -1028,7 +1033,7 @@ mod test {
#[tokio::test] #[tokio::test]
async fn test_open_file() { async fn test_open_file() {
let temp_dir = TempDir::new(); let temp_dir = TempDir::new();
let temp_path = temp_dir.path(); let temp_path = canonicalize_path(temp_dir.path()).unwrap();
let mut builder = VfsBuilder::new(temp_path.to_path_buf()).unwrap(); let mut builder = VfsBuilder::new(temp_path.to_path_buf()).unwrap();
builder builder
.add_file( .add_file(