mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
chore(tests): use custom temp dir creation for the tests (#14153)
This commit is contained in:
parent
8ca4c1819f
commit
1c37ac3352
33 changed files with 385 additions and 247 deletions
|
@ -1,15 +1,15 @@
|
|||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use std::process::{Command, Stdio};
|
||||
use tempfile::TempDir;
|
||||
use test_util as util;
|
||||
use test_util::TempDir;
|
||||
|
||||
// Warning: this test requires internet access.
|
||||
// TODO(#7412): reenable. test is flaky
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn upgrade_in_tmpdir() {
|
||||
let temp_dir = TempDir::new().unwrap();
|
||||
let temp_dir = TempDir::new();
|
||||
let exe_path = temp_dir.path().join("deno");
|
||||
let _ = std::fs::copy(util::deno_exe_path(), &exe_path).unwrap();
|
||||
assert!(exe_path.exists());
|
||||
|
@ -31,10 +31,7 @@ fn upgrade_in_tmpdir() {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn upgrade_with_space_in_path() {
|
||||
let temp_dir = tempfile::Builder::new()
|
||||
.prefix("directory with spaces")
|
||||
.tempdir()
|
||||
.unwrap();
|
||||
let temp_dir = TempDir::new_with_prefix("directory with spaces");
|
||||
let exe_path = temp_dir.path().join("deno");
|
||||
let _ = std::fs::copy(util::deno_exe_path(), &exe_path).unwrap();
|
||||
assert!(exe_path.exists());
|
||||
|
@ -54,7 +51,7 @@ fn upgrade_with_space_in_path() {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn upgrade_with_version_in_tmpdir() {
|
||||
let temp_dir = TempDir::new().unwrap();
|
||||
let temp_dir = TempDir::new();
|
||||
let exe_path = temp_dir.path().join("deno");
|
||||
let _ = std::fs::copy(util::deno_exe_path(), &exe_path).unwrap();
|
||||
assert!(exe_path.exists());
|
||||
|
@ -83,7 +80,7 @@ fn upgrade_with_version_in_tmpdir() {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn upgrade_with_canary_in_tmpdir() {
|
||||
let temp_dir = TempDir::new().unwrap();
|
||||
let temp_dir = TempDir::new();
|
||||
let exe_path = temp_dir.path().join("deno");
|
||||
let _ = std::fs::copy(util::deno_exe_path(), &exe_path).unwrap();
|
||||
assert!(exe_path.exists());
|
||||
|
@ -112,7 +109,7 @@ fn upgrade_with_canary_in_tmpdir() {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn upgrade_with_out_in_tmpdir() {
|
||||
let temp_dir = TempDir::new().unwrap();
|
||||
let temp_dir = TempDir::new();
|
||||
let exe_path = temp_dir.path().join("deno");
|
||||
let new_exe_path = temp_dir.path().join("foo");
|
||||
let _ = std::fs::copy(util::deno_exe_path(), &exe_path).unwrap();
|
||||
|
@ -149,7 +146,7 @@ fn upgrade_with_out_in_tmpdir() {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn upgrade_invalid_stable_version() {
|
||||
let temp_dir = TempDir::new().unwrap();
|
||||
let temp_dir = TempDir::new();
|
||||
let exe_path = temp_dir.path().join("deno");
|
||||
let _ = std::fs::copy(util::deno_exe_path(), &exe_path).unwrap();
|
||||
assert!(exe_path.exists());
|
||||
|
@ -174,7 +171,7 @@ fn upgrade_invalid_stable_version() {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn upgrade_invalid_canary_version() {
|
||||
let temp_dir = TempDir::new().unwrap();
|
||||
let temp_dir = TempDir::new();
|
||||
let exe_path = temp_dir.path().join("deno");
|
||||
let _ = std::fs::copy(util::deno_exe_path(), &exe_path).unwrap();
|
||||
assert!(exe_path.exists());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue