Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cbcf794

Browse filesBrowse files
ErickWendelruyadorno
authored andcommitted
readline: improve code coverage for readline promises
PR-URL: #41817 Refs: https://coverage.nodejs.org/coverage-7123a00b03a90862/lib/readline/promises.js.html#L42 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
1 parent 451f333 commit cbcf794
Copy full SHA for cbcf794

File tree

Expand file treeCollapse file tree

1 file changed

+18
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-readline-promises-interface.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-readline-promises-interface.js
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,24 @@ for (let i = 0; i < 12; i++) {
797797
fi.emit('data', 'asdf\n');
798798
}
799799

800+
// Ensure that options.signal.removeEventListener was called
801+
{
802+
const ac = new AbortController();
803+
const signal = ac.signal;
804+
const [rli] = getInterface({ terminal });
805+
signal.removeEventListener = common.mustCall(
806+
(event, onAbortFn) => {
807+
assert.strictEqual(event, 'abort');
808+
assert.strictEqual(onAbortFn.name, 'onAbort');
809+
});
810+
811+
rli.question('hello?', { signal }).then(common.mustCall());
812+
813+
rli.write('bar\n');
814+
ac.abort();
815+
rli.close();
816+
}
817+
800818
// Sending a blank line
801819
{
802820
const [rli, fi] = getInterface({ terminal });

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.