diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2024-02-13 21:52:30 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-13 21:52:30 +0530 |
commit | a68eb3fcc3997fce8680f87edce46f6450e79635 (patch) | |
tree | 6839607033226fdfb2ce1be3187ef93791096507 /test_util/src/builders.rs | |
parent | 492a9fbb9194a24a1f9223f797b4f4df9efde2bd (diff) |
feat: denort binary for `deno compile` (#22205)
This introduces the `denort` binary - a slim version of deno without
tooling. The binary is used as the default for `deno compile`.
Improves `deno compile` final size by ~2.5x (141 MB -> 61 MB) on Linux
x86_64.
Diffstat (limited to 'test_util/src/builders.rs')
-rw-r--r-- | test_util/src/builders.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test_util/src/builders.rs b/test_util/src/builders.rs index 862838dcb..9e9c64cf5 100644 --- a/test_util/src/builders.rs +++ b/test_util/src/builders.rs @@ -20,6 +20,7 @@ use os_pipe::pipe; use crate::assertions::assert_wildcard_match; use crate::deno_exe_path; +use crate::denort_exe_path; use crate::env_vars_for_jsr_tests; use crate::env_vars_for_npm_tests; use crate::fs::PathRef; @@ -80,7 +81,7 @@ pub struct TestContextBuilder { impl TestContextBuilder { pub fn new() -> Self { - Self::default() + Self::default().add_compile_env_vars() } pub fn for_npm() -> Self { @@ -158,6 +159,13 @@ impl TestContextBuilder { self } + pub fn add_compile_env_vars(mut self) -> Self { + // The `denort` binary is in the same artifact directory as the `deno` binary. + let denort_bin = denort_exe_path(); + self = self.env("DENORT_BIN", denort_bin.to_string()); + self + } + pub fn add_jsr_env_vars(mut self) -> Self { for (key, value) in env_vars_for_jsr_tests() { self = self.env(key, value); @@ -236,7 +244,7 @@ impl Default for TestContext { impl TestContext { pub fn with_http_server() -> Self { - TestContextBuilder::default().use_http_server().build() + TestContextBuilder::new().use_http_server().build() } pub fn deno_dir(&self) -> &TempDir { |