Skip to content

Commit

Permalink
test: Refactored tests that were still using the tap mocha shim + chai
Browse files Browse the repository at this point in the history
to now use tap.
  • Loading branch information
bizob2828 committed Dec 19, 2023
1 parent 2d666b6 commit 0f912ce
Show file tree
Hide file tree
Showing 77 changed files with 4,550 additions and 4,576 deletions.
258 changes: 114 additions & 144 deletions THIRD_PARTY_NOTICES.md

Large diffs are not rendered by default.

133 changes: 0 additions & 133 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -213,7 +213,6 @@
"ajv": "^6.12.6",
"async": "^3.2.4",
"c8": "^8.0.1",
"chai": "^4.1.2",
"clean-jsdoc-theme": "^4.2.4",
"commander": "^7.0.0",
"conventional-changelog-conventionalcommits": "^5.0.0",
Expand Down
5 changes: 2 additions & 3 deletions test/integration/collector-remote-method.tap.js
Expand Up @@ -13,7 +13,7 @@ const url = require('url')
const collector = require('../lib/fake-collector')
const RemoteMethod = require('../../lib/collector/remote-method')
const NAMES = require('../../lib/metrics/names')
const { tapAssertMetrics } = require('../lib/metrics_helper')
require('../lib/metrics_helper')
const { instrumentMockedAgent, unloadAgent } = require('../lib/agent_helper')
const { SSL_HOST } = require('../lib/agent_helper')

Expand Down Expand Up @@ -176,8 +176,7 @@ tap.test('record data usage supportability metrics', (t) => {
method.invoke(payload, resolve)
})

tapAssertMetrics(
t,
t.assertMetricValues(
{
metrics: agent.metrics
},
Expand Down
12 changes: 6 additions & 6 deletions test/integration/instrumentation/fetch.tap.js
Expand Up @@ -81,7 +81,7 @@ tap.test('fetch', { skip: semver.lte(process.version, '18.0.0') }, function (t)
})
t.equal(status, 200)

metrics.assertSegments(tx.trace.root, [`External/${HOST}/post`], { exact: false })
t.assertSegments(tx.trace.root, [`External/${HOST}/post`], { exact: false })
tx.end()
t.end()
})
Expand Down Expand Up @@ -152,7 +152,7 @@ tap.test('fetch', { skip: semver.lte(process.version, '18.0.0') }, function (t)
const [{ status }, { status: status2 }] = await Promise.all([req1, req2])
t.equal(status, 200)
t.equal(status2, 200)
metrics.assertSegments(tx.trace.root, [`External/${HOST}/post`, `External/${HOST}/put`], {
t.assertSegments(tx.trace.root, [`External/${HOST}/post`, `External/${HOST}/put`], {
exact: false
})
tx.end()
Expand All @@ -168,7 +168,7 @@ tap.test('fetch', { skip: semver.lte(process.version, '18.0.0') }, function (t)
})
} catch (err) {
t.equal(err.message, 'fetch failed')
metrics.assertSegments(tx.trace.root, ['External/invalidurl/foo'], { exact: false })
t.assertSegments(tx.trace.root, ['External/invalidurl/foo'], { exact: false })
t.equal(tx.exceptions.length, 1)
tx.end()
t.end()
Expand All @@ -188,7 +188,7 @@ tap.test('fetch', { skip: semver.lte(process.version, '18.0.0') }, function (t)
}, 100)
await req
} catch (err) {
metrics.assertSegments(tx.trace.root, [`External/${HOST}/delay/1000`], { exact: false })
t.assertSegments(tx.trace.root, [`External/${HOST}/delay/1000`], { exact: false })
t.equal(tx.exceptions.length, 1)
t.equal(tx.exceptions[0].error.name, 'AbortError')
tx.end()
Expand All @@ -215,7 +215,7 @@ tap.test('fetch', { skip: semver.lte(process.version, '18.0.0') }, function (t)
try {
await req
} catch (error) {
metrics.assertSegments(transaction.trace.root, [`External/localhost:${port}/`], {
t.assertSegments(transaction.trace.root, [`External/localhost:${port}/`], {
exact: false
})

Expand All @@ -236,7 +236,7 @@ tap.test('fetch', { skip: semver.lte(process.version, '18.0.0') }, function (t)
helper.runInTransaction(agent, async (tx) => {
const { status } = await fetch(`${REQUEST_URL}/status/400`)
t.equal(status, 400)
metrics.assertSegments(tx.trace.root, [`External/${HOST}/status/400`], { exact: false })
t.assertSegments(tx.trace.root, [`External/${HOST}/status/400`], { exact: false })
tx.end()
t.end()
})
Expand Down

0 comments on commit 0f912ce

Please sign in to comment.