supertest
supertest copied to clipboard
🕷 Super-agent driven library for testing node.js HTTP servers using a fluent API. Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
Hi Running my tests through GItlab CI returns the following error `Error: ECONNREFUSED: Connection`, but they all pass and work fine locally. Please see my stackoverflow for more details [thread](https://stackoverflow.com/questions/51099240/node-mocha-supertest-error-econnrefused-connection-refused?noredirect=1#comment89186924_51099240)
`TypeError: res.status is not a function 49 | }) 50 | .catch(error => { > 51 | return res.status(400).json({ | ^ 52 | success: false, 53 | error, 54 |...
hey I was trying to test my express API endpoints as you see below: ``` test('POST: Send registration request', done => { superTest(Api) .post('/auth/register') .set('Content-Type', 'multipart/form-data') .send(fakeUser) .expect('Content-Type', 'application/json; charset=utf-8')...
Hi folks, I love supertest but I got annoyed by simple assert messages like ``` expected { products: [ { de: [Object], en: [Object] } ] } response body, got...
``` FetchError: invalid json response body at reason: Unexpected end of JSON input at node_modules/node-fetch/lib/index.js:272:32 ``` Here is my code: ``` const response = await request(app) .get('/api/demos') .expect(200); ```
Trying to send file via attach method is not working.. ``` await request(app.getHttpServer()) .post('/uploads/avatar') .set('Content-type', 'application/octet-stream') .auth(userToken.accessToken, { type: 'bearer' }) .attach('file', buffer, 'test.jpg') .expect(({ status, body }) => {...
Hey everyone, I have been experiencing memory leaks in any test files that require supertest when using Jest with the `--detectLeaks` option on an express server. ### Versions node: **12.16.1**...
Express App `require('dotenv').config(); const express = require('express'); const app = express(); const cors = require('cors'); const PORT = process.env.PORT; app.use(cors()) app.get('/', (req, res) => { res.status(200).json({ message: 'it worked' })...
I'm working on API First mode generating routes from openapi3.x specifications, and using supertests to execute BDD, serving the swagger-ui by using yaml.file, sort of like: ``` //swagger.decorator.ts import YAML...
I'm using supertest to test api route in a node/typescript application. When launching the test, the server crashes with this error: > ReferenceError: You are trying to import a file...