Skip to content

Commit

Permalink
investigate warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Nov 13, 2024
1 parent 51836bb commit 3f10dc6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions test/fetch/long-lived-abort-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const { fetch } = require('../../')
const { once } = require('events')
const { test } = require('node:test')
const { closeServerAsPromise } = require('../utils/node-http')
const { strictEqual } = require('node:assert')
const { strictEqual, fail } = require('node:assert')

// const isNode18 = process.version.startsWith('v18')
const isNode18 = process.version.startsWith('v18')

test('long-lived-abort-controller', { skip: true }, async (t) => {
test('long-lived-abort-controller', { skip: isNode18 }, async (t) => {
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.write('Hello World!')
Expand All @@ -20,9 +20,9 @@ test('long-lived-abort-controller', { skip: true }, async (t) => {

t.after(closeServerAsPromise(server))

let warningEmitted = false
function onWarning () {
warningEmitted = true
let emittedWarning = null
function onWarning (value) {
emittedWarning = value
}
process.on('warning', onWarning)
t.after(() => {
Expand All @@ -44,5 +44,9 @@ test('long-lived-abort-controller', { skip: true }, async (t) => {
await res.text()
}

strictEqual(warningEmitted, false)
if (emittedWarning !== null) {
fail(emittedWarning)
} else {
strictEqual(emittedWarning, null)
}
})

0 comments on commit 3f10dc6

Please sign in to comment.