Skip to main content

Questions tagged [supertest]

SuperTest is a module that provides high-level abstraction for testing HTTP in node.js, using low-level API provided by super-agent.

supertest
0 votes
0 answers
13 views

No metadata for "User" was found using TypeORM, ExpressJS, Supertest and Testcontainers

I am trying to write integration tests for an expressjs application which uses TypeORM and a PostgreSQL database. The main application works fine without any issues with a main datasource, migrations ...
greazleay's user avatar
1 vote
0 answers
78 views

SyntaxError: Cannot use 'import.meta' outside a module

I'm using Jest and Supertest in my Node.js project. I also use ESM. After importing app.js to a example.test.js by ES modules and running npm test it throws an error. error: FAIL tests/feedback.test....
Amin's user avatar
  • 19
0 votes
0 answers
15 views

Test Fails after Establishing Connection to Database

I have a repo for a node app that uses an object to store the data temporarily. I updated the code to connect to MongoDB and some of the tests start failing. The test is one with supertest. The code ...
Uzoma Nwanne's user avatar
0 votes
0 answers
24 views

Jest/supertest returns duplicated data from postgres even thought the result set is unique

I have an API endpoint that takes a client ID and returns its info Inside, express+typescript calls the Postgres function and returns JSON. If I run the call by any other means but supertest, the ...
Ruslan Tolkachev's user avatar
1 vote
2 answers
51 views

How to mock imported express middleware with jest and using supertest?

I have tests using supertest to connect to a server and I am trying to mock an authentication and an authorisation middlewares with Jest. I have found couple other questions which answers I have tried ...
zaplec's user avatar
  • 1,781
1 vote
1 answer
32 views

Jest Testing: Difficulty Mocking Functions Across Files

I'm trying to write tests for the CreateVendor function using Jest and Supertest. I'm stuck on how to mock the dependencies (generateSalt, hashPassword) to properly test the function's behavior. I'm ...
Haris Bukhari's user avatar
1 vote
1 answer
135 views

Can you import Supertest as a ES6 module?

I am trying to use Jest with Supertest package to test my API. I tried using import { request } from "supertest"; to be able to use request in my file but got a SyntaxError saying that the ...
GenesysRTA's user avatar
0 votes
0 answers
22 views

TypeORM entities are not found in the test file

I'm using TypeORM and ExpressJS. I'm encountering an issue while attempting to access the database in a test file. Whenever I encounter an error, it says that the entities is not found. Here's my ...
Bhavesh Sharma's user avatar
0 votes
2 answers
39 views

How do I send multiple values with same key with supertest?

In my testing, I need to simulate sending checkbox form data. In a normal HTML form with checkboxes, if a form box is checked, the corresponding key, value is sent. Consider a form that asks user for ...
Sebastian Hothaza's user avatar
0 votes
0 answers
33 views

Jest open handles with supertest get

I'm testing a POST and GET endpoint with supertest. My test fails to exit cleanly. However, when I run --detectOpenHandles, the script just hangs with no print output. Additionally, if I comment out ...
ashissl's user avatar
  • 147
0 votes
0 answers
85 views

Got Error: read ECONNRESET when sending with supertest

I have an route where I upload files. before I upload I have two middlewares. one for checking the jwt token, and the other is multer. At first I check if the jwt token exists when not throw an error. ...
serverz's user avatar
  • 85
0 votes
0 answers
109 views

"Exceeded timeout of 10000 ms for a test: In call "request" from "supertest" on integrations test with jest and typescript

I am receiving this error message: "Exceeded timeout of 10000 ms for a test. when i run integrations tests in my project. The timeout value is 10000 cause I changed this value when call request() ...
Paulo Roberto's user avatar
0 votes
0 answers
20 views

supertest mocha Why I get success test passing although expected fails?

I use supertest and mocha and all works but I got one problem. If I use the expect function and it fails my test says still its passing but this is false it should show an error and not passed. What I ...
festlest's user avatar
1 vote
0 answers
302 views

Unable to run unit test with Next.js, Prisma, and Supertest

I am trying to run a unit test for a basic app api get route in Next.js. I am using Mysql as the database and Prisma as the ORM. Typescript is the language being used. Originally, I was getting an ...
Sean Bristol-Lee's user avatar

15 30 50 per page
1
2 3 4 5
62