From 5af1dcfe292eb5f8cb60e72cf8f532596739b7fc Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Tue, 27 Oct 2020 23:19:27 +1100 Subject: fix(cli): do not throw on empty typescript files (#8143) Co-authored-by: Luca Casonato Co-authored-by: Ryan Dahl --- cli/tests/integration_tests.rs | 5 +++++ cli/tests/subdir/empty.ts | 0 cli/tsc/99_main_compiler.js | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 cli/tests/subdir/empty.ts (limited to 'cli') diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 5a6bdae14..cfc946a36 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2273,6 +2273,11 @@ itest!(config { output: "config.ts.out", }); +itest!(emtpy_typescript { + args: "run --reload subdir/empty.ts", + output_str: Some("Check file:[WILDCARD]tests/subdir/empty.ts\n"), +}); + itest!(error_001 { args: "run --reload error_001.ts", exit_code: 1, diff --git a/cli/tests/subdir/empty.ts b/cli/tests/subdir/empty.ts new file mode 100644 index 000000000..e69de29bb diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index 470c1fcee..1248bad5a 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -374,7 +374,10 @@ delete Object.prototype.__proto__; "op_load", { specifier }, ); - assert(data, `"data" is unexpectedly null for "${specifier}".`); + assert( + data != null, + `"data" is unexpectedly null for "${specifier}".`, + ); sourceFile = ts.createSourceFile( specifier, data, -- cgit v1.2.3