2022-01-07 22:09:52 -05:00
|
|
|
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
2021-06-27 13:27:36 -04:00
|
|
|
|
|
|
|
use crate::itest;
|
|
|
|
|
|
|
|
itest!(_036_import_map_fetch {
|
|
|
|
args:
|
|
|
|
"cache --quiet --reload --import-map=import_maps/import_map.json import_maps/test.ts",
|
|
|
|
output: "036_import_map_fetch.out",
|
|
|
|
});
|
|
|
|
|
|
|
|
itest!(_037_fetch_multiple {
|
|
|
|
args: "cache --reload fetch/test.ts fetch/other.ts",
|
|
|
|
http_server: true,
|
|
|
|
output: "037_fetch_multiple.out",
|
|
|
|
});
|
|
|
|
|
|
|
|
itest!(_095_cache_with_bare_import {
|
|
|
|
args: "cache 095_cache_with_bare_import.ts",
|
|
|
|
output: "095_cache_with_bare_import.ts.out",
|
|
|
|
exit_code: 1,
|
|
|
|
});
|
|
|
|
|
|
|
|
itest!(cache_extensionless {
|
2021-08-11 10:20:47 -04:00
|
|
|
args: "cache --reload http://localhost:4545/subdir/no_js_ext",
|
2021-06-27 13:27:36 -04:00
|
|
|
output: "cache_extensionless.out",
|
|
|
|
http_server: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
itest!(cache_random_extension {
|
2021-08-11 10:20:47 -04:00
|
|
|
args: "cache --reload http://localhost:4545/subdir/no_js_ext@1.0.0",
|
2021-06-27 13:27:36 -04:00
|
|
|
output: "cache_random_extension.out",
|
|
|
|
http_server: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
itest!(performance_stats {
|
|
|
|
args: "cache --reload --log-level debug 002_hello.ts",
|
|
|
|
output: "performance_stats.out",
|
|
|
|
});
|
|
|
|
|
|
|
|
itest!(redirect_cache {
|
|
|
|
http_server: true,
|
2021-08-11 10:20:47 -04:00
|
|
|
args: "cache --reload http://localhost:4548/subdir/redirects/a.ts",
|
2021-06-27 13:27:36 -04:00
|
|
|
output: "redirect_cache.out",
|
|
|
|
});
|
|
|
|
|
|
|
|
itest!(ignore_require {
|
|
|
|
args: "cache --reload --no-check ignore_require.js",
|
|
|
|
output_str: Some(""),
|
|
|
|
exit_code: 0,
|
|
|
|
});
|
2022-02-03 08:08:17 -05:00
|
|
|
|
|
|
|
// This test only runs on linux, because it hardcodes the XDG_CACHE_HOME env var
|
|
|
|
// which is only used on linux.
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[test]
|
|
|
|
fn relative_home_dir() {
|
|
|
|
use test_util as util;
|
2022-04-01 11:15:37 -04:00
|
|
|
use test_util::TempDir;
|
2022-02-03 08:08:17 -05:00
|
|
|
|
2022-04-01 11:15:37 -04:00
|
|
|
let deno_dir = TempDir::new_in(&util::testdata_path());
|
2022-02-03 08:08:17 -05:00
|
|
|
let path = deno_dir.path().strip_prefix(util::testdata_path()).unwrap();
|
|
|
|
|
|
|
|
let mut deno_cmd = util::deno_cmd();
|
|
|
|
let output = deno_cmd
|
|
|
|
.current_dir(util::testdata_path())
|
|
|
|
.env("XDG_CACHE_HOME", path)
|
|
|
|
.env_remove("HOME")
|
|
|
|
.env_remove("DENO_DIR")
|
|
|
|
.arg("cache")
|
|
|
|
.arg("--reload")
|
|
|
|
.arg("--no-check")
|
|
|
|
.arg("002_hello.ts")
|
|
|
|
.stdout(std::process::Stdio::piped())
|
|
|
|
.spawn()
|
|
|
|
.unwrap()
|
|
|
|
.wait_with_output()
|
|
|
|
.unwrap();
|
|
|
|
assert!(output.status.success());
|
|
|
|
assert_eq!(output.stdout, b"");
|
|
|
|
}
|
2022-05-17 17:53:42 -04:00
|
|
|
|
|
|
|
itest!(check_local_by_default {
|
|
|
|
args: "cache --quiet cache/check_local_by_default.ts",
|
|
|
|
output: "cache/check_local_by_default.out",
|
|
|
|
http_server: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
itest!(check_local_by_default2 {
|
|
|
|
args: "cache --quiet cache/check_local_by_default2.ts",
|
|
|
|
output: "cache/check_local_by_default2.out",
|
|
|
|
http_server: true,
|
|
|
|
exit_code: 1,
|
|
|
|
});
|