supertest icon indicating copy to clipboard operation
supertest copied to clipboard

[fix] bug based on node version

Open HongChaeMin opened this issue 1 year ago • 2 comments

Describe the bug

Node.js version: v22.1.0

OS version: MacOS Sonoma 14.4.1(23E224)

Description: From node 22 version, Array.isArray has been deprecated (https://nodejs.org/api/deprecations.html)

request(app.getHttpServer())
    .post(router)
    .set('Content-Type', 'multipart/form-data')
    .field('country', data.country)
    .field('businessLocation', data.businessLocation)
    .attach('file', 'test/resources/image.png')
    .expect(HttpStatus.CREATED)
    .expect(({ body }) => {
        expect(body).toBeDefined();
    });
(node:13214) [DEP0044] DeprecationWarning: The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

When you run code on Webstorm, get the above log and when you run it on cli, get the log Aborted. Maybe using isArrayinside the field and attach functions.

Checklist

  • [x] I have searched through GitHub issues for similar issues.
  • [x] I have completely read through the README and documentation.
  • [x] I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.

HongChaeMin avatar May 31 '24 00:05 HongChaeMin

I can confirm this issue... The issue rests with the dependency on the form-data 4.0 package which makes use of this call.

j-maynard avatar Jun 11 '24 13:06 j-maynard

I can confirm this issue... The issue rests with the dependency on the form-data 4.0 package which makes use of this call.

Thanks for the comment. can i fix this? Or should I wait for the version to be updated?

HongChaeMin avatar Jun 27 '24 06:06 HongChaeMin