supertest
supertest copied to clipboard
Run the first example
I am trying to run the first example.
const request = require('supertest');
const express = require('express');
const app = express();
app.get('/user', function(req, res) {
res.status(200).json({ name: 'john' });
});
request(app)
.get('/user')
.expect('Content-Type', /json/)
.expect('Content-Length', '15')
.expect(200)
.end(function(err, res) {
if (err) throw err;
});
But, It crashes with an Operation timed out error:
Error: ETIMEDOUT: Operation timed out
at Test.assert (G:\Projects\Nodejs\testJest\node_modules\supertest\lib\test.js:200:18)
at Server.localAssert (G:\Projects\Nodejs\testJest\node_modules\supertest\lib\test.js:166:12)
at Object.onceWrapper (events.js:481:28)
at Server.emit (events.js:375:28)
at emitCloseNT (net.js:1661:8)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
I using node v14.17.1, and npm v6.14.13.