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: updated abort controller test expected error message based on undici version #1935

Merged
merged 1 commit into from Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/versioned/undici/requests.tap.js
Expand Up @@ -11,6 +11,8 @@ const helper = require('../../lib/agent_helper')
const metrics = require('../../lib/metrics_helper')
const http = require('http')
const https = require('https')
const { version: pkgVersion } = require('undici/package')
const semver = require('semver')

tap.test('Undici request tests', (t) => {
t.autoend()
Expand Down Expand Up @@ -241,7 +243,10 @@ tap.test('Undici request tests', (t) => {
} catch (err) {
t.assertSegments(tx.trace.root, [`External/${HOST}/delay/1000`], { exact: false })
t.equal(tx.exceptions.length, 1)
t.equal(tx.exceptions[0].error.message, 'Request aborted')
const expectedErrMsg = semver.gte(pkgVersion, '6.3.0')
? 'This operation was aborted'
: 'Request aborted'
t.equal(tx.exceptions[0].error.message, expectedErrMsg)
tx.end()
t.end()
}
Expand Down