test: avoid assigning this to variables by cjihrig · Pull Request #10548 · nodejs/node · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions test/parallel/test-cluster-worker-wait-server-close.js
3 changes: 1 addition & 2 deletions test/parallel/test-http-client-timeout-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ server.listen(0, options.host, function() {
this.destroy();
});
req.setTimeout(50, function() {
var req = this;
console.log('req#' + this.id + ' timeout');
req.abort();
this.abort();
requests_done += 1;
});
req.end();
Expand Down
14 changes: 6 additions & 8 deletions test/parallel/test-repl-persistent-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,24 @@ os.homedir = function() {
class ActionStream extends stream.Stream {
run(data) {
const _iter = data[Symbol.iterator]();
const self = this;

function doAction() {
const doAction = () => {
const next = _iter.next();
if (next.done) {
// Close the repl. Note that it must have a clean prompt to do so.
setImmediate(function() {
self.emit('keypress', '', { ctrl: true, name: 'd' });
setImmediate(() => {
this.emit('keypress', '', { ctrl: true, name: 'd' });
});
return;
}
const action = next.value;

if (typeof action === 'object') {
self.emit('keypress', '', action);
this.emit('keypress', '', action);
} else {
self.emit('data', action + '\n');
this.emit('data', action + '\n');
}
setImmediate(doAction);
}
};
setImmediate(doAction);
}
resume() {}
Expand Down
32 changes: 16 additions & 16 deletions test/parallel/test-zlib.js