diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 825aeea..4ce8d45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,9 @@ jobs: strategy: matrix: node-version: - - 10 - - 12 - 14 - 16 + - 18 os: - macos-latest - ubuntu-latest diff --git a/formbody.js b/formbody.js index e778516..a9ac701 100644 --- a/formbody.js +++ b/formbody.js @@ -27,6 +27,6 @@ function formBodyPlugin (fastify, options, next) { } module.exports = fp(formBodyPlugin, { - fastify: '^3.0.0', - name: 'fastify-formbody' + fastify: '^4.0.0', + name: '@fastify/formbody' }) diff --git a/package.json b/package.json index ca29a8e..50d8064 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "devDependencies": { "@types/node": "^17.0.0", "codecov": "^3.7.2", - "fastify": "^3.3.0", + "fastify": "^4.0.0-rc.2", "pre-commit": "^1.2.2", "qs": "^6.5.1", "request": "^2.88.0", diff --git a/test/integration.test.js b/test/integration.test.js index 6dad4d6..0733f67 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -16,7 +16,7 @@ test('succes route succeeds', (t) => { res.send(Object.assign({}, req.body, { message: 'done' })) }) - fastify.listen(0, (err) => { + fastify.listen({ port: 0 }, (err) => { if (err) tap.error(err) fastify.server.unref() @@ -42,7 +42,7 @@ test('cannot exceed body limit', (t) => { res.send(Object.assign({}, req.body, { message: 'done' })) }) - fastify.listen(0, (err) => { + fastify.listen({ port: 0 }, (err) => { if (err) tap.error(err) fastify.server.unref() @@ -76,7 +76,7 @@ test('cannot exceed body limit when Content-Length is not available', (t) => { res.send(Object.assign({}, req.body, { message: 'done' })) }) - fastify.listen(0, (err) => { + fastify.listen({ port: 0 }, (err) => { if (err) tap.error(err) fastify.server.unref() @@ -112,7 +112,7 @@ test('cannot exceed body limit set on Fastify instance', (t) => { res.send(Object.assign({}, req.body, { message: 'done' })) }) - fastify.listen(0, (err) => { + fastify.listen({ port: 0 }, (err) => { if (err) tap.error(err) fastify.server.unref() @@ -139,7 +139,7 @@ test('plugin bodyLimit should overwrite Fastify instance bodyLimit', (t) => { res.send(Object.assign({}, req.body, { message: 'done' })) }) - fastify.listen(0, (err) => { + fastify.listen({ port: 0 }, (err) => { if (err) tap.error(err) fastify.server.unref() @@ -161,7 +161,7 @@ test('plugin should throw if opts.parser is not a function', (t) => { t.plan(2) const fastify = Fastify() fastify.register(plugin, { parser: 'invalid' }) - fastify.listen(0, (err) => { + fastify.listen({ port: 0 }, (err) => { t.ok(err) t.match(err.message, /parser must be a function/) fastify.server.unref() @@ -177,7 +177,7 @@ test('plugin should not parse nested objects by default', (t) => { res.send(Object.assign({}, req.body, { message: 'done' })) }) - fastify.listen(0, (err) => { + fastify.listen({ port: 0 }, (err) => { if (err) tap.error(err) fastify.server.unref() @@ -204,7 +204,7 @@ test('plugin should allow providing custom parser as option', (t) => { res.send(Object.assign({}, req.body, { message: 'done' })) }) - fastify.listen(0, (err) => { + fastify.listen({ port: 0 }, (err) => { if (err) tap.error(err) fastify.server.unref()