diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/tests/tsc2/file_exportc.ts | 1 | ||||
-rw-r--r-- | cli/tests/tsc2/file_reexports.ts | 3 | ||||
-rw-r--r-- | cli/tests/tsc2/https_deno.land-x-c.d.ts | 1 | ||||
-rw-r--r-- | cli/tests/tsc2/https_deno.land-x-c.js | 1 | ||||
-rw-r--r-- | cli/tsc2.rs | 50 |
5 files changed, 56 insertions, 0 deletions
diff --git a/cli/tests/tsc2/file_exportc.ts b/cli/tests/tsc2/file_exportc.ts new file mode 100644 index 000000000..efcc5bb46 --- /dev/null +++ b/cli/tests/tsc2/file_exportc.ts @@ -0,0 +1 @@ +export * as c from "https://deno.land/x/c.js"; diff --git a/cli/tests/tsc2/file_reexports.ts b/cli/tests/tsc2/file_reexports.ts new file mode 100644 index 000000000..b26297423 --- /dev/null +++ b/cli/tests/tsc2/file_reexports.ts @@ -0,0 +1,3 @@ +import * as c from "./exportc.ts"; + +console.log(c.c); diff --git a/cli/tests/tsc2/https_deno.land-x-c.d.ts b/cli/tests/tsc2/https_deno.land-x-c.d.ts new file mode 100644 index 000000000..bf3a09240 --- /dev/null +++ b/cli/tests/tsc2/https_deno.land-x-c.d.ts @@ -0,0 +1 @@ +export const c: string; diff --git a/cli/tests/tsc2/https_deno.land-x-c.js b/cli/tests/tsc2/https_deno.land-x-c.js new file mode 100644 index 000000000..7f2cfac77 --- /dev/null +++ b/cli/tests/tsc2/https_deno.land-x-c.js @@ -0,0 +1 @@ +export const c = "c"; diff --git a/cli/tsc2.rs b/cli/tsc2.rs index fab94a9f7..54e99a651 100644 --- a/cli/tsc2.rs +++ b/cli/tsc2.rs @@ -610,4 +610,54 @@ mod tests { assert!(actual.maybe_tsbuildinfo.is_some()); assert_eq!(actual.stats.0.len(), 12); } + + #[tokio::test] + async fn test_exec_reexport_dts() { + let specifier = + ModuleSpecifier::resolve_url_or_path("file:///reexports.ts").unwrap(); + let hash_data = vec![b"something".to_vec()]; + let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); + let fixtures = c.join("tests/tsc2"); + let handler = Rc::new(RefCell::new(MockSpecifierHandler { + fixtures, + ..MockSpecifierHandler::default() + })); + let mut builder = GraphBuilder2::new(handler.clone(), None, None); + builder + .add(&specifier, false) + .await + .expect("module not inserted"); + let graph = Rc::new(RefCell::new(builder.get_graph())); + let config = TsConfig::new(json!({ + "allowJs": true, + "checkJs": false, + "esModuleInterop": true, + "emitDecoratorMetadata": false, + "incremental": true, + "jsx": "react", + "jsxFactory": "React.createElement", + "jsxFragmentFactory": "React.Fragment", + "lib": ["deno.window"], + "module": "esnext", + "noEmit": true, + "outDir": "deno:///", + "strict": true, + "target": "esnext", + "tsBuildInfoFile": "deno:///.tsbuildinfo", + })); + let request = Request { + config, + debug: false, + graph, + hash_data, + maybe_tsbuildinfo: None, + root_names: vec!["file:///reexports.ts".to_string()], + }; + let actual = exec(js::compiler_isolate_init(), request) + .expect("exec should have not errored"); + assert!(actual.diagnostics.0.is_empty()); + assert!(actual.emitted_files.is_empty()); + assert!(actual.maybe_tsbuildinfo.is_some()); + assert_eq!(actual.stats.0.len(), 12); + } } |