diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-10-27 23:19:27 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-27 13:19:27 +0100 |
commit | 5af1dcfe292eb5f8cb60e72cf8f532596739b7fc (patch) | |
tree | 17bc2cb4710cb90a81916cdc13353c56607a78df | |
parent | 30f3b831d31ec47e7d120bcd34194b7b69e6f716 (diff) |
fix(cli): do not throw on empty typescript files (#8143)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
-rw-r--r-- | cli/tests/integration_tests.rs | 5 | ||||
-rw-r--r-- | cli/tests/subdir/empty.ts | 0 | ||||
-rw-r--r-- | cli/tsc/99_main_compiler.js | 5 |
3 files changed, 9 insertions, 1 deletions
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 --- /dev/null +++ b/cli/tests/subdir/empty.ts 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, |