1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

chore: ensure cache is 'valid' during benchmarks (#7770)

This commit is contained in:
Kitson Kelly 2020-10-01 20:32:05 +10:00 committed by GitHub
parent da29ccece5
commit ef5ae4547a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 9 deletions

View file

@ -24,13 +24,9 @@ fn write_json(filename: &str, value: &Value) -> Result<()> {
/// The list of the tuples of the benchmark name, arguments and return code /// The list of the tuples of the benchmark name, arguments and return code
const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
("hello", &["run", "cli/tests/002_hello.ts"], None), // we need to run the cold_* benchmarks before the _warm_ ones as they ensure
( // the cache is properly populated, instead of other tests possibly
"relative_import", // invalidating that cache.
&["run", "cli/tests/003_relative_import.ts"],
None,
),
("error_001", &["run", "cli/tests/error_001.ts"], Some(1)),
( (
"cold_hello", "cold_hello",
&["run", "--reload", "cli/tests/002_hello.ts"], &["run", "--reload", "cli/tests/002_hello.ts"],
@ -41,6 +37,13 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
&["run", "--reload", "cli/tests/003_relative_import.ts"], &["run", "--reload", "cli/tests/003_relative_import.ts"],
None, None,
), ),
("hello", &["run", "cli/tests/002_hello.ts"], None),
(
"relative_import",
&["run", "cli/tests/003_relative_import.ts"],
None,
),
("error_001", &["run", "cli/tests/error_001.ts"], Some(1)),
( (
"no_check_hello", "no_check_hello",
&["run", "--reload", "--no-check", "cli/tests/002_hello.ts"], &["run", "--reload", "--no-check", "cli/tests/002_hello.ts"],

View file

@ -237,8 +237,7 @@ impl TsConfig {
), ),
) )
})?; })?;
let config_bytes = std::fs::read(config_path.clone())?; let config_text = std::fs::read_to_string(config_path.clone())?;
let config_text = std::str::from_utf8(&config_bytes)?;
let (value, maybe_ignored_options) = let (value, maybe_ignored_options) =
parse_config(&config_text, &config_path)?; parse_config(&config_text, &config_path)?;
json_merge(&mut self.0, &value); json_merge(&mut self.0, &value);