Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use node: prefix to bypass require.cache call for builtins #144

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test('cannot exceed body limit', (t) => {
if (err) tap.error(err)
fastify.server.unref()

const payload = require('crypto').randomBytes(128).toString('hex')
const payload = require('node:crypto').randomBytes(128).toString('hex')
fastify.inject({ path: '/limited', method: 'POST', ...formAutoContent({ foo: payload }) }, (err, response) => {
t.error(err)
t.equal(response.statusCode, 413)
Expand Down Expand Up @@ -71,7 +71,7 @@ test('cannot exceed body limit when Content-Length is not available', (t) => {
fastify.server.unref()

let sent = false
const payload = require('stream').Readable({
const payload = require('node:stream').Readable({
read: function () {
this.push(sent ? null : Buffer.alloc(70000, 'a'))
sent = true
Expand All @@ -98,7 +98,7 @@ test('cannot exceed body limit set on Fastify instance', (t) => {
if (err) tap.error(err)
fastify.server.unref()

const payload = require('crypto').randomBytes(128).toString('hex')
const payload = require('node:crypto').randomBytes(128).toString('hex')
fastify.inject({ path: '/limited', method: 'POST', ...formAutoContent({ foo: payload }) }, (err, response) => {
t.error(err)
t.equal(response.statusCode, 413)
Expand All @@ -120,7 +120,7 @@ test('plugin bodyLimit should overwrite Fastify instance bodyLimit', (t) => {
if (err) tap.error(err)
fastify.server.unref()

const payload = require('crypto').randomBytes(128).toString('hex')
const payload = require('node:crypto').randomBytes(128).toString('hex')
fastify.inject({ path: '/limited', method: 'POST', ...formAutoContent({ foo: payload }) }, (err, response) => {
t.error(err)
t.equal(response.statusCode, 413)
Expand Down
Loading