Skip to content

Commit 2f4e416

Browse files
dario-piotrowiczaduh95
authored andcommitted
test: add missing newlines to repl .exit writes
some tests write `.exit` into a repl server without including a newline character (`\n`), such commands are therefore simply not executed at all, the changes here add the missing newlines and as a side effect remove no longer necessary `end` calls PR-URL: #58041 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
1 parent 2338630 commit 2f4e416

5 files changed

+7
-10
lines changed

test/parallel/test-repl-function-definition-edge-case.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Reference: https://github.com/nodejs/node/pull/7624
22
'use strict';
3-
require('../common');
3+
const common = require('../common');
44
const assert = require('assert');
55
const repl = require('repl');
66
const stream = require('stream');
@@ -9,7 +9,8 @@ const r = initRepl();
99

1010
r.input.emit('data', 'function a() { return 42; } (1)\n');
1111
r.input.emit('data', 'a\n');
12-
r.input.emit('data', '.exit');
12+
r.input.emit('data', '.exit\n');
13+
r.once('exit', common.mustCall());
1314

1415
const expected = '1\n[Function: a]\n';
1516
const got = r.output.accumulator.join('');

test/parallel/test-repl-import-referrer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@ child.on('exit', common.mustCall(() => {
2323
}));
2424

2525
child.stdin.write('await import(\'./message.mjs\');\n');
26-
child.stdin.write('.exit');
27-
child.stdin.end();
26+
child.stdin.write('.exit\n');

test/parallel/test-repl-options.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,5 @@ r4.close();
136136
child.stdin.write(
137137
'assert.ok(util.inspect(repl.repl, {depth: -1}).includes("REPLServer"));\n'
138138
);
139-
child.stdin.write('.exit');
140-
child.stdin.end();
139+
child.stdin.write('.exit\n');
141140
}

test/parallel/test-repl-require-context.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ child.on('exit', common.mustCall(() => {
2020
child.stdin.write('const isObject = (obj) => obj.constructor === Object;\n');
2121
child.stdin.write('isObject({});\n');
2222
child.stdin.write(`require(${JSON.stringify(fixture)}).isObject({});\n`);
23-
child.stdin.write('.exit');
24-
child.stdin.end();
23+
child.stdin.write('.exit\n');

test/parallel/test-repl-require-self-referential.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@ child.on('exit', common.mustCall(() => {
2323
}));
2424

2525
child.stdin.write('require("self_ref");\n');
26-
child.stdin.write('.exit');
27-
child.stdin.end();
26+
child.stdin.write('.exit\n');

0 commit comments

Comments
 (0)