Skip to content

Commit

Permalink
test: skip IPv6 tests if not supported (nodejs#1476)
Browse files Browse the repository at this point in the history
  • Loading branch information
LiviaMedeiros authored and metcoder95 committed Dec 26, 2022
1 parent 48b8ac5 commit 54ca221
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/client.js
Expand Up @@ -10,6 +10,14 @@ const { wrapWithAsyncIterable } = require('./utils/async-iterators')
const EE = require('events')
const { kUrl, kSize, kConnect, kBusy, kConnected, kRunning } = require('../lib/core/symbols')

const hasIPv6 = (() => {
const iFaces = require('os').networkInterfaces()
const re = process.platform === 'win32' ? /Loopback Pseudo-Interface/ : /lo/
return Object.keys(iFaces).some(
(name) => re.test(name) && iFaces[name].some(({ family }) => family === 6)
)
})()

test('basic get', (t) => {
t.plan(24)

Expand Down Expand Up @@ -421,7 +429,7 @@ test('basic head', (t) => {
})
})

test('basic head (IPv6)', (t) => {
test('basic head (IPv6)', { skip: !hasIPv6 }, (t) => {
t.plan(14)

const server = createServer((req, res) => {
Expand Down Expand Up @@ -492,7 +500,7 @@ test('get with host header', (t) => {
})
})

test('get with host header (IPv6)', (t) => {
test('get with host header (IPv6)', { skip: !hasIPv6 }, (t) => {
t.plan(7)

const server = createServer((req, res) => {
Expand Down

0 comments on commit 54ca221

Please sign in to comment.