8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent af6608c commit 506b50aCopy full SHA for 506b50a
test/parallel/test-repl-pretty-custom-stack.js
@@ -5,6 +5,7 @@ const fixtures = require('../common/fixtures');
5
const assert = require('assert');
6
const repl = require('repl');
7
8
+const stackRegExp = /repl:[0-9]+:[0-9]+/g;
9
10
function run({ command, expected }) {
11
let accum = '';
@@ -23,7 +24,10 @@ function run({ command, expected }) {
23
24
});
25
26
r.write(`${command}\n`);
- assert.strictEqual(accum, expected);
27
+ assert.strictEqual(
28
+ accum.replace(stackRegExp, 'repl:*:*'),
29
+ expected.replace(stackRegExp, 'repl:*:*')
30
+ );
31
r.close();
32
}
33
@@ -44,8 +48,8 @@ const tests = [
44
48
{
45
49
// test .load for a file that throws
46
50
command: `.load ${fixtures.path('repl-pretty-stack.js')}`,
47
- expected: 'Thrown:\nError: Whoops!--->\nrepl:9:24--->\nd (repl:12:3)' +
- '--->\nc (repl:9:3)--->\nb (repl:6:3)--->\na (repl:3:3)\n'
51
+ expected: 'Thrown:\nError: Whoops!--->\nrepl:*:*--->\nd (repl:*:*)' +
52
+ '--->\nc (repl:*:*)--->\nb (repl:*:*)--->\na (repl:*:*)\n'
53
},
54
55
command: 'let x y;',
@@ -63,7 +67,7 @@ const tests = [
63
67
// test anonymous IIFE
64
68
65
69
command: '(function() { throw new Error(\'Whoops!\'); })()',
66
- expected: 'Thrown:\nError: Whoops!--->\nrepl:1:21\n'
70
+ expected: 'Thrown:\nError: Whoops!--->\nrepl:*:*\n'
71
72
];
73
test/parallel/test-repl-pretty-stack.js
+const stackRegExp = /(at .*repl:)[0-9]+:[0-9]+/g;
function run({ command, expected, ...extraREPLOptions }) {
@@ -24,17 +25,20 @@ function run({ command, expected, ...extraREPLOptions }) {
+ accum.replace(stackRegExp, '$1*:*'),
+ expected.replace(stackRegExp, '$1*:*')
34
35
const tests = [
36
37
// Test .load for a file that throws.
38
- expected: 'Thrown:\nError: Whoops!\n at repl:9:24\n' +
- ' at d (repl:12:3)\n at c (repl:9:3)\n' +
- ' at b (repl:6:3)\n at a (repl:3:3)\n'
39
+ expected: 'Thrown:\nError: Whoops!\n at repl:*:*\n' +
40
+ ' at d (repl:*:*)\n at c (repl:*:*)\n' +
41
+ ' at b (repl:*:*)\n at a (repl:*:*)\n'
42
43
@@ -48,12 +52,12 @@ const tests = [
command: '(() => { const err = Error(\'Whoops!\'); ' +
'err.foo = \'bar\'; throw err; })()',
- expected: "Thrown:\nError: Whoops!\n at repl:1:22 {\n foo: 'bar'\n}\n",
+ expected: "Thrown:\nError: Whoops!\n at repl:*:* {\n foo: 'bar'\n}\n",
56
57
58
59
- expected: 'Thrown:\nError: Whoops!\n at repl:1:22 {\n foo: ' +
60
+ expected: 'Thrown:\nError: Whoops!\n at repl:*:* {\n foo: ' +
61
"\u001b[32m'bar'\u001b[39m\n}\n",
62
useColors: true
@@ -64,7 +68,7 @@ const tests = [
// Test anonymous IIFE.
- expected: 'Thrown:\nError: Whoops!\n at repl:1:21\n'
+ expected: 'Thrown:\nError: Whoops!\n at repl:*:*\n'
74