diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-09-04 17:16:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-04 17:16:46 -0400 |
commit | 9d62d77cfa98b5e741dbcf0c657b530fc2770b24 (patch) | |
tree | cefb3b701c4ccc08856cbd6f53ebcc33a829e883 /cli/compilers | |
parent | 82588ec09c199683cff88097e1b90649497239c7 (diff) |
Run tests after "cargo build" on travis (#2854)
Diffstat (limited to 'cli/compilers')
-rw-r--r-- | cli/compilers/ts.rs | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/cli/compilers/ts.rs b/cli/compilers/ts.rs index 414f18e14..8330d86e9 100644 --- a/cli/compilers/ts.rs +++ b/cli/compilers/ts.rs @@ -405,7 +405,7 @@ impl TsCompiler { .get_compiled_module(&source_file_.url) .map_err(|e| { // TODO: this situation shouldn't happen - panic!("Expected to find compiled file: {}", e) + panic!("Expected to find compiled file: {} {}", e, source_file_.url) }) }) .and_then(move |compiled_module| { @@ -658,18 +658,23 @@ mod tests { #[test] fn test_compile_sync() { tokio_util::init(|| { + let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .parent() + .unwrap() + .join("tests/002_hello.ts") + .to_owned(); let specifier = - ModuleSpecifier::resolve_url_or_path("./tests/002_hello.ts").unwrap(); + ModuleSpecifier::resolve_url_or_path(p.to_str().unwrap()).unwrap(); let out = SourceFile { url: specifier.as_url().clone(), - filename: PathBuf::from("/tests/002_hello.ts"), + filename: PathBuf::from(p.to_str().unwrap().to_string()), media_type: msg::MediaType::TypeScript, source_code: include_bytes!("../../tests/002_hello.ts").to_vec(), }; let mock_state = ThreadSafeState::mock(vec![ - String::from("./deno"), + String::from("deno"), String::from("hello.js"), ]); let compiled = mock_state @@ -685,15 +690,19 @@ mod tests { #[test] fn test_bundle_async() { - let specifier = "./tests/002_hello.ts"; + let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .parent() + .unwrap() + .join("tests/002_hello.ts") + .to_owned(); use deno::ModuleSpecifier; - let module_name = ModuleSpecifier::resolve_url_or_path(specifier) + let module_name = ModuleSpecifier::resolve_url_or_path(p.to_str().unwrap()) .unwrap() .to_string(); let state = ThreadSafeState::mock(vec![ - String::from("./deno"), - String::from("./tests/002_hello.ts"), + String::from("deno"), + p.to_string_lossy().into(), String::from("$deno$/bundle.js"), ]); let out = state.ts_compiler.bundle_async( |