Skip to content

Commit 5d8cb68

Browse files
authored
lib: add typescript support to STDIN eval
nodejs/node#56359
1 parent 1d10bd7 commit 5d8cb68

2 files changed

Lines changed: 84 additions & 0 deletions

File tree

‎patches/node/.patches‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ test_handle_explicit_resource_management_globals.patch
4242
linux_try_preadv64_pwritev64_before_preadv_pwritev_4683.patch
4343
build_remove_explicit_linker_call_to_libm_on_macos.patch
4444
build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch
45+
test_make_eval_snapshot_tests_more_flexible.patch
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Shelley Vohr <shelley.vohr@gmail.com>
3+
Date: Wed, 12 Feb 2025 21:01:13 +0100
4+
Subject: test: make eval snapshot tests more flexible
5+
6+
Upstreamed in X
7+
8+
diff --git a/test/fixtures/eval/eval_messages.snapshot b/test/fixtures/eval/eval_messages.snapshot
9+
index f6fc803e0e3ec3f6a0c7cd056f42ac860012c907..998a06584b3bf3648e6703774aeb31c07bdb5d0e 100644
10+
--- a/test/fixtures/eval/eval_messages.snapshot
11+
+++ b/test/fixtures/eval/eval_messages.snapshot
12+
@@ -35,7 +35,7 @@ Node.js *
13+
var ______________________________________________; throw 10
14+
^
15+
10
16+
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
17+
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
18+
19+
Node.js *
20+
21+
@@ -43,7 +43,7 @@ Node.js *
22+
var ______________________________________________; throw 10
23+
^
24+
10
25+
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
26+
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
27+
28+
Node.js *
29+
done
30+
diff --git a/test/fixtures/eval/stdin_messages.snapshot b/test/fixtures/eval/stdin_messages.snapshot
31+
index 66bd506f758ca93906f850a9c773b617745eb834..0382a6ae3ccd792523cc19847bbdeef4d53e1579 100644
32+
--- a/test/fixtures/eval/stdin_messages.snapshot
33+
+++ b/test/fixtures/eval/stdin_messages.snapshot
34+
@@ -40,7 +40,7 @@ Node.js *
35+
let ______________________________________________; throw 10
36+
^
37+
10
38+
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
39+
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
40+
41+
Node.js *
42+
43+
@@ -48,7 +48,7 @@ Node.js *
44+
let ______________________________________________; throw 10
45+
^
46+
10
47+
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
48+
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
49+
50+
Node.js *
51+
done
52+
diff --git a/test/parallel/test-node-output-eval.mjs b/test/parallel/test-node-output-eval.mjs
53+
index d8c52176b1c3c3a0664d7f6b6750da03aa960587..8a3cc59574206769e4c80a04f05b03586f511ac2 100644
54+
--- a/test/parallel/test-node-output-eval.mjs
55+
+++ b/test/parallel/test-node-output-eval.mjs
56+
@@ -1,6 +1,7 @@
57+
import '../common/index.mjs';
58+
import * as fixtures from '../common/fixtures.mjs';
59+
import * as snapshot from '../common/assertSnapshot.js';
60+
+import { basename } from 'node:path';
61+
import { describe, it } from 'node:test';
62+
63+
describe('eval output', { concurrency: true }, () => {
64+
@@ -16,6 +17,7 @@ describe('eval output', { concurrency: true }, () => {
65+
snapshot.replaceNodeVersion,
66+
removeStackTraces,
67+
filterEmptyLines,
68+
+ generalizeProcessName,
69+
);
70+
71+
function removeStackTraces(output) {
72+
@@ -26,6 +28,11 @@ describe('eval output', { concurrency: true }, () => {
73+
return output.replaceAll(/^\s*$/gm, '');
74+
}
75+
76+
+ function generalizeProcessName(output) {
77+
+ const baseName = basename(process.argv0 || 'node', '.exe');
78+
+ return output.replaceAll(`${baseName} --`, '* --');
79+
+ }
80+
+
81+
const tests = [
82+
{ name: 'eval/eval_messages.js' },
83+
{ name: 'eval/stdin_messages.js' },

0 commit comments

Comments
 (0)