caolan / caolan/nodeunit

Test with nodeunit 0.5.3 hangs used to work with 0.5.1

Open
#83 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.9k
Forks
359
PR merge metrics
No merged PRs in 30d

Description

Following test hangs with 0.5.3 but works with 0.5.1

``` javascript
var net = require('net');

exports['init-conn-test'] = function (test) {
var someServer = net.createServer();
var port = 1122;

var done = false;

var interval = setInterval(function() {
if (!done) {
test.ok(false, 'init-conn-test is expected to finish in 3 secs');
test.done();
}
try {
someServer.close();
}
catch(e) {
// eat it
}
clearInterval(interval);
}, 3000);

someServer.on('connection', function(sock) {
sock.on('data', function(data) {
lastEvent = data;
test.deepEqual(data.toString(), 'Testing123');
try {
someServer.close();
}
catch(e) {
// eat it
}
done = true;
clearInterval(interval);
test.done();
})
});

someServer.listen(port, 'localhost', function() {
var socket = net.createConnection(port, 'localhost');
socket.write('Testing123');
});
};
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the supplied test with nodeunit 0.5.3 and 0.5.1 to reproduce the hang and compare behavior. Trace the test runner's handling of the asynchronous net server, socket, interval, and test.done calls. Done means the test completes within the expected time on 0.5.3 without changing the test's intended assertions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.