supertest icon indicating copy to clipboard operation
supertest copied to clipboard

Run the first example

Open zl0i opened this issue 4 years ago • 0 comments

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.

My package.json and package-lock.json

zl0i avatar Aug 03 '21 01:08 zl0i