ladjs / superagent

Ajax for Node.js and browsers (JS HTTP client). Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
https://ladjs.github.io/superagent/
MIT License
16.59k stars 1.33k forks source link

Exception using send() function #1568

Closed stormwind85 closed 4 years ago

stormwind85 commented 4 years ago

I've tried to run my tests using the Supertest library, that includes Superagent library.

Here is a basic example of test I want to execute in my project.

const messageObj = {
  id: "123456",
  message: "blablabla"
};
const headers = {
  "Content-Type": "application/json",
};
await supertest
    .post('/')
    .send(messageObj)
    .set(headers)
    .expect(200);

I run my tests with the following command : yarn run jest your_test_file.test.js

I got an exception with this and here is the error message :

TypeError: mime.lookup is not a function

And this error refers to the send() function because if I'm running the same test without sending data (without using send() function), it works !

So, could you please check about your send() function because I can't use it anymore during my tests.

stormwind85 commented 4 years ago

I notice that it has been fixed after doing a yarn install.

Therefore, I'm closing this issue.