Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion test/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const shouldHaveBody = utils.shouldHaveBody
const shouldHitHandle = utils.shouldHitHandle
const shouldNotHaveBody = utils.shouldNotHaveBody
const shouldNotHitHandle = utils.shouldNotHitHandle
const shouldSkipQueryHttpMethod = utils.shouldSkipQueryHttpMethod
const methods = utils.methods

describe('Router', function () {
Expand Down Expand Up @@ -254,7 +255,8 @@ describe('Router', function () {
// CONNECT is tricky and supertest doesn't support it
return
}
if (method === 'query' && process.version.startsWith('v21')) {

if (shouldSkipQueryHttpMethod()) {
return
}

Expand Down
7 changes: 5 additions & 2 deletions test/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const shouldHaveBody = utils.shouldHaveBody
const shouldHitHandle = utils.shouldHitHandle
const shouldNotHaveBody = utils.shouldNotHaveBody
const shouldNotHitHandle = utils.shouldNotHitHandle
const shouldSkipQueryHttpMethod = utils.shouldSkipQueryHttpMethod
const methods = utils.methods

describe('Router', function () {
Expand Down Expand Up @@ -51,7 +52,8 @@ describe('Router', function () {
// CONNECT is tricky and supertest doesn't support it
return cb()
}
if (method === 'query' && process.version.startsWith('v21')) {

if (shouldSkipQueryHttpMethod()) {
return cb()
}

Expand Down Expand Up @@ -317,7 +319,8 @@ describe('Router', function () {
// CONNECT is tricky and supertest doesn't support it
return
}
if (method === 'query' && process.version.startsWith('v21')) {

if (shouldSkipQueryHttpMethod()) {
return
}

Expand Down
7 changes: 7 additions & 0 deletions test/support/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ exports.shouldHaveBody = shouldHaveBody
exports.shouldNotHaveBody = shouldNotHaveBody
exports.shouldHitHandle = shouldHitHandle
exports.shouldNotHitHandle = shouldNotHitHandle
exports.shouldSkipQueryHttpMethod = shouldSkipQueryHttpMethod
exports.methods = methods

function createHitHandle (num) {
Expand Down Expand Up @@ -140,3 +141,9 @@ function shouldNotHaveHeader (header) {
assert.ok(!(header.toLowerCase() in res.headers), 'should not have header ' + header)
}
}

// Skipping HTTP QUERY tests below Node 22, QUERY wasn't fully supported by Node until 22
function shouldSkipQueryHttpMethod () {
const majorVersion = Number(process.versions.node.split('.')[0])
return majorVersion < 22
}