From 3ac8b5a8af0619123aab8d2fa4884921286e6f71 Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Mon, 22 Dec 2025 13:46:09 -0500 Subject: [PATCH] test: yield to warnings printer --- test/fixtures/stacktrace.ts | 6 +++++- test/loader.test.js | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/fixtures/stacktrace.ts b/test/fixtures/stacktrace.ts index 7314a6568..9a155e864 100644 --- a/test/fixtures/stacktrace.ts +++ b/test/fixtures/stacktrace.ts @@ -1,4 +1,8 @@ enum Foo { A = "Hello, TypeScript!", } -throw new Error(Foo.A); + +// Allow warnings about source maps to be shown for testing purposes. +setImmediate(() => { + throw new Error(Foo.A); +}); diff --git a/test/loader.test.js b/test/loader.test.js index d3ed4a3c4..3d00a86db 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -47,7 +47,7 @@ test("should warn and inaccurate stracktrace", async () => { strictEqual(result.stdout, ""); match(result.stderr, /Source maps are disabled/); - match(result.stderr, /stacktrace.ts:5:7/); // inaccurate + match(result.stderr, /stacktrace.ts:7:11/); // inaccurate strictEqual(result.code, 1); }); @@ -60,7 +60,7 @@ test("should not warn and accurate stracktrace", async () => { doesNotMatch(result.stderr, /Source maps are disabled/); strictEqual(result.stdout, ""); - match(result.stderr, /stacktrace.ts:4:7/); // accurate + match(result.stderr, /stacktrace.ts:7:9/); // accurate strictEqual(result.code, 1); });