Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRemove unnecessary setTimeout in test files #2699
Comments
|
@yasuf I came up with a kind of explanation that it makes sure |
|
@chinesedfan the timeout is to give the test a little bit of time to run. In that particular test, the The tests probably should use axios.get('http://localhost:4444/', {
maxContentLength: 2000
}).then(function (res) {
success = true;
}).catch(function (err) {
error = err;
failure = true;
}).finally(function () {
assert.equal(success, false, 'request should not succeed');
assert.equal(failure, true, 'request should fail');
assert.equal(error.message, 'maxContentLength size of 2000 exceeded');
done();
});The problem is browser compatibility. For example, chrome 32+ support catch but finally requires chrome 63+ |
Exactly. And even a second
I think that's the biggest advantage. If someone breaks |
There are lots of
setTimeoutin our tests. Some are unnecessary, i.e.