From b0d0534a9c28d08625d384ae01779a9ef24d05c5 Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Mon, 2 Jun 2025 13:24:40 -0500 Subject: [PATCH 1/3] replace hasOwnProperty with Object.hasOwn Signed-off-by: Sebastian Beltran --- lib/read-body.js | 5 ++--- package.json | 1 - test/body.js | 9 ++++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/read-body.js b/lib/read-body.js index c7277504..a748acfa 100644 --- a/lib/read-body.js +++ b/lib/read-body.js @@ -4,7 +4,6 @@ import { promisify } from 'node:util' import Busboy from '@fastify/busboy' import { createWriteStream } from 'fs-temp' -import hasOwnProperty from 'has-own-property' import _onFinished from 'on-finished' import FileType from 'stream-file-type' @@ -29,7 +28,7 @@ function collectFields (busboy, limits) { if (valueTruncated) return reject(new MulterError('LIMIT_FIELD_VALUE', fieldname)) // Work around bug in Busboy (https://github.com/mscdex/busboy/issues/6) - if (limits && hasOwnProperty(limits, 'fieldNameSize') && fieldname.length > limits.fieldNameSize) { + if (limits && Object.hasOwn(limits, 'fieldNameSize') && fieldname.length > limits.fieldNameSize) { return reject(new MulterError('LIMIT_FIELD_KEY')) } @@ -54,7 +53,7 @@ function collectFiles (busboy, limits, fileFilter) { }) // Work around bug in Busboy (https://github.com/mscdex/busboy/issues/6) - if (limits && hasOwnProperty(limits, 'fieldNameSize') && fieldname.length > limits.fieldNameSize) { + if (limits && Object.hasOwn(limits, 'fieldNameSize') && fieldname.length > limits.fieldNameSize) { return reject(new MulterError('LIMIT_FIELD_KEY')) } diff --git a/package.json b/package.json index 242e6757..5aa5ce3f 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "append-field": "^2.0.0", "bytes": "^3.1.0", "fs-temp": "^2.0.1", - "has-own-property": "^2.0.0", "on-finished": "^2.3.0", "stream-file-type": "^0.6.1", "type-is": "^1.6.18" diff --git a/test/body.js b/test/body.js index bd25a61c..631f9f19 100644 --- a/test/body.js +++ b/test/body.js @@ -5,7 +5,6 @@ import stream from 'node:stream' import { promisify } from 'node:util' import FormData from 'form-data' -import hasOwnProperty from 'has-own-property' import recursiveNullify from 'recursive-nullify' import testData from 'testdata-w3c-json-form' @@ -72,8 +71,8 @@ describe('body', () => { await promisify(parser)(req, null) - assert.strictEqual(hasOwnProperty(req, 'body'), false) - assert.strictEqual(hasOwnProperty(req, 'files'), false) + assert.strictEqual(Object.hasOwn(req, 'body'), false) + assert.strictEqual(Object.hasOwn(req, 'files'), false) }) it('should not process non-multipart GET request', async () => { @@ -88,8 +87,8 @@ describe('body', () => { await promisify(parser)(req, null) - assert.strictEqual(hasOwnProperty(req, 'body'), false) - assert.strictEqual(hasOwnProperty(req, 'files'), false) + assert.strictEqual(Object.hasOwn(req, 'body'), false) + assert.strictEqual(Object.hasOwn(req, 'files'), false) }) for (const test of testData) { From 59ba2c4e8c28c5b50a69f4cc1f9601c099f0bd82 Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Mon, 2 Jun 2025 13:34:02 -0500 Subject: [PATCH 2/3] fix ci Signed-off-by: Sebastian Beltran --- .github/workflows/test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4d84292e..6d240189 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,17 +3,18 @@ name: Node CI on: pull_request: branches: - - master + - v3 push: branches: - - explore-new-api + - v3 jobs: test: strategy: + fail-fast: false matrix: os: [ubuntu-latest, macOS-latest, windows-latest] - node: [12.20.0, 14.13.1, 16.0.0] + node: [12.20.0, 14.13.1, 16.0.0, 16, 17, 18, 19, 20, 21, 22, 23, 24] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 From 2c6a47d9cda75cb4a297f2c57e26c19c4ca21252 Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Mon, 2 Jun 2025 13:59:53 -0500 Subject: [PATCH 3/3] test: add --exit flag Signed-off-by: Sebastian Beltran --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5aa5ce3f..79b0f990 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,6 @@ "lib/" ], "scripts": { - "test": "standard && c8 --check-coverage --statements 100 mocha" + "test": "standard && c8 --check-coverage --statements 100 mocha --exit" } }