From 8cdb309ffd6686b2f3c4a2126d927fd5770be34d Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 25 Sep 2024 09:04:57 -0400 Subject: fix(check): properly surface dependency errors in types file of js file (#25860) We weren't surfacing dependency errors in types files of js files. --- .../check/dts_importing_non_existent/__test__.jsonc | 5 +++++ .../specs/check/dts_importing_non_existent/check.out | 2 ++ .../specs/check/dts_importing_non_existent/index.d.ts | 1 + tests/specs/check/dts_importing_non_existent/index.js | 1 + tests/specs/run/sloppy_imports/__test__.jsonc | 19 +++++++++++-------- tests/specs/run/sloppy_imports/sloppy.out | 1 + 6 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 tests/specs/check/dts_importing_non_existent/__test__.jsonc create mode 100644 tests/specs/check/dts_importing_non_existent/check.out create mode 100644 tests/specs/check/dts_importing_non_existent/index.d.ts create mode 100644 tests/specs/check/dts_importing_non_existent/index.js (limited to 'tests') diff --git a/tests/specs/check/dts_importing_non_existent/__test__.jsonc b/tests/specs/check/dts_importing_non_existent/__test__.jsonc new file mode 100644 index 000000000..3775b7fb4 --- /dev/null +++ b/tests/specs/check/dts_importing_non_existent/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "check index.js", + "output": "check.out", + "exitCode": 1 +} diff --git a/tests/specs/check/dts_importing_non_existent/check.out b/tests/specs/check/dts_importing_non_existent/check.out new file mode 100644 index 000000000..80ec9593b --- /dev/null +++ b/tests/specs/check/dts_importing_non_existent/check.out @@ -0,0 +1,2 @@ +error: Module not found "file:///[WILDLINE]/test". + at file:///[WILDLINE]/index.d.ts:1:22 diff --git a/tests/specs/check/dts_importing_non_existent/index.d.ts b/tests/specs/check/dts_importing_non_existent/index.d.ts new file mode 100644 index 000000000..4216ca3ed --- /dev/null +++ b/tests/specs/check/dts_importing_non_existent/index.d.ts @@ -0,0 +1 @@ +export { Test } from "./test"; diff --git a/tests/specs/check/dts_importing_non_existent/index.js b/tests/specs/check/dts_importing_non_existent/index.js new file mode 100644 index 000000000..4b2c5ecce --- /dev/null +++ b/tests/specs/check/dts_importing_non_existent/index.js @@ -0,0 +1 @@ +/// diff --git a/tests/specs/run/sloppy_imports/__test__.jsonc b/tests/specs/run/sloppy_imports/__test__.jsonc index 79aaaba69..a992f390b 100644 --- a/tests/specs/run/sloppy_imports/__test__.jsonc +++ b/tests/specs/run/sloppy_imports/__test__.jsonc @@ -1,10 +1,13 @@ { - "steps": [{ - "args": "run main.ts", - "output": "no_sloppy.out", - "exitCode": 1 - }, { - "args": "run --unstable-sloppy-imports main.ts", - "output": "sloppy.out" - }] + "tests": { + "no_sloppy": { + "args": "run --check main.ts", + "output": "no_sloppy.out", + "exitCode": 1 + }, + "sloppy": { + "args": "run --unstable-sloppy-imports --check main.ts", + "output": "sloppy.out" + } + } } diff --git a/tests/specs/run/sloppy_imports/sloppy.out b/tests/specs/run/sloppy_imports/sloppy.out index 170a4bb16..2cc57b6fc 100644 --- a/tests/specs/run/sloppy_imports/sloppy.out +++ b/tests/specs/run/sloppy_imports/sloppy.out @@ -1,3 +1,4 @@ +Check file:///[WILDLINE]/main.ts [class A] [class B] [class C] -- cgit v1.2.3