From b16613d4eae10650f46eea77133f9d56a72d3df9 Mon Sep 17 00:00:00 2001
From: Bob Evans <robert.evans25@gmail.com>
Date: Tue, 10 Sep 2024 14:55:04 -0400
Subject: [PATCH] test: Migrated `test/unit/spans` to use `node:test`

---
 test/unit/spans/base-span-streamer.test.js    |  25 +-
 test/unit/spans/batch-span-streamer.test.js   | 125 ++++---
 .../create-span-event-aggregator.test.js      | 125 ++++---
 test/unit/spans/map-to-streaming-type.test.js |  64 ++--
 test/unit/spans/span-event-aggregator.test.js | 189 +++++------
 test/unit/spans/span-event.test.js            | 306 +++++++++---------
 test/unit/spans/span-streamer.test.js         |  80 ++---
 .../spans/streaming-span-attributes.test.js   |  34 +-
 .../streaming-span-event-aggregator.test.js   |  30 +-
 test/unit/spans/streaming-span-event.test.js  | 294 +++++++++--------
 10 files changed, 621 insertions(+), 651 deletions(-)

diff --git a/test/unit/spans/base-span-streamer.test.js b/test/unit/spans/base-span-streamer.test.js
index d88ee1f7d3..652aef8c08 100644
--- a/test/unit/spans/base-span-streamer.test.js
+++ b/test/unit/spans/base-span-streamer.test.js
@@ -4,35 +4,34 @@
  */
 
 'use strict'
-const tap = require('tap')
+const assert = require('node:assert')
+const test = require('node:test')
 const { createFakeConnection, createMetricAggregator } = require('./span-streamer-helpers')
 const BaseSpanStreamer = require('../../../lib/spans/base-span-streamer')
 
-tap.test('SpanStreamer', (t) => {
-  t.autoend()
-  let spanStreamer
-
-  t.beforeEach(() => {
+test('SpanStreamer', async (t) => {
+  t.beforeEach((ctx) => {
+    ctx.nr = {}
     const fakeConnection = createFakeConnection()
 
-    spanStreamer = new BaseSpanStreamer(
+    ctx.nr.spanStreamer = new BaseSpanStreamer(
       'fake-license-key',
       fakeConnection,
       createMetricAggregator(),
       2
     )
   })
-  ;['addToQueue', 'sendQueue'].forEach((method) => {
-    t.test(`should throw error when ${method} is called`, (t) => {
-      t.throws(
+
+  for (const method of ['addToQueue', 'sendQueue']) {
+    await t.test(`should throw error when ${method} is called`, (t) => {
+      const { spanStreamer } = t.nr
+      assert.throws(
         () => {
           spanStreamer[method]()
         },
         Error,
         `${method} is not implemented`
       )
-
-      t.end()
     })
-  })
+  }
 })
diff --git a/test/unit/spans/batch-span-streamer.test.js b/test/unit/spans/batch-span-streamer.test.js
index e70dc7f3aa..c1fb19c642 100644
--- a/test/unit/spans/batch-span-streamer.test.js
+++ b/test/unit/spans/batch-span-streamer.test.js
@@ -4,77 +4,76 @@
  */
 
 'use strict'
-const tap = require('tap')
+const assert = require('node:assert')
+const test = require('node:test')
 const sinon = require('sinon')
 const SpanStreamerEvent = require('../../../lib/spans/streaming-span-event.js')
 const METRIC_NAMES = require('../../../lib/metrics/names')
 const { createFakeConnection, createMetricAggregator } = require('./span-streamer-helpers')
 const BatchSpanStreamer = require('../../../lib/spans/batch-span-streamer')
 
-tap.test('BatchSpanStreamer', (t) => {
-  t.autoend()
-  let fakeConnection
-  let spanStreamer
+test('BatchSpanStreamer', async (t) => {
+  t.beforeEach((ctx) => {
+    ctx.nr = {}
+    const fakeConnection = createFakeConnection()
 
-  t.beforeEach(() => {
-    fakeConnection = createFakeConnection()
-
-    spanStreamer = new BatchSpanStreamer(
+    ctx.nr.spanStreamer = new BatchSpanStreamer(
       'fake-license-key',
       fakeConnection,
       createMetricAggregator(),
       2
     )
     fakeConnection.connectSpans()
+    ctx.nr.fakeConnection = fakeConnection
   })
 
-  t.afterEach(() => {
+  t.afterEach((ctx) => {
+    const { spanStreamer } = ctx.nr
     if (spanStreamer.stream) {
       spanStreamer.stream.destroy()
     }
   })
 
-  t.test('should create a spanStreamer instance', (t) => {
-    t.ok(spanStreamer, 'instantiated the object')
-    t.end()
+  await t.test('should create a spanStreamer instance', (t) => {
+    const { spanStreamer } = t.nr
+    assert.ok(spanStreamer, 'instantiated the object')
   })
 
-  t.test('should setup flush queue for every 5 seconds on connect', (t) => {
-    t.ok(spanStreamer.sendTimer)
-    t.notOk(spanStreamer.sendTimer._destroyed)
+  await t.test('should setup flush queue for every 5 seconds on connect', (t) => {
+    const { fakeConnection, spanStreamer } = t.nr
+    assert.ok(spanStreamer.sendTimer)
+    assert.ok(!spanStreamer.sendTimer._destroyed)
     fakeConnection.disconnect()
-    t.ok(spanStreamer.sendTimer._destroyed)
-    t.end()
+    assert.ok(spanStreamer.sendTimer._destroyed)
   })
 
-  t.test('Should increment SEEN metric on write', (t) => {
+  await t.test('Should increment SEEN metric on write', (t) => {
+    const { spanStreamer } = t.nr
     const metricsSpy = sinon.spy(spanStreamer._metrics, 'getOrCreateMetric')
     const fakeSpan = new SpanStreamerEvent('sandwich', {}, {})
     spanStreamer.write(fakeSpan)
 
-    t.ok(metricsSpy.firstCall.calledWith(METRIC_NAMES.INFINITE_TRACING.SEEN), 'SEEN metric')
-
-    t.end()
+    assert.ok(metricsSpy.firstCall.calledWith(METRIC_NAMES.INFINITE_TRACING.SEEN), 'SEEN metric')
   })
 
-  t.test('Should add span to queue on backpressure', (t) => {
+  await t.test('Should add span to queue on backpressure', (t) => {
+    const { spanStreamer } = t.nr
     spanStreamer._writable = false
-    t.equal(spanStreamer.spans.length, 0, 'no spans queued')
+    assert.equal(spanStreamer.spans.length, 0, 'no spans queued')
     const fakeSpan = new SpanStreamerEvent('sandwich', {}, {})
     spanStreamer.write(fakeSpan)
 
-    t.equal(spanStreamer.spans.length, 1, 'one span queued')
-
-    t.end()
+    assert.equal(spanStreamer.spans.length, 1, 'one span queued')
   })
 
-  t.test('Should drain span queue on stream drain event', (t) => {
+  await t.test('Should drain span queue on stream drain event', (t) => {
+    const { fakeConnection, spanStreamer } = t.nr
     /* simulate backpressure */
     fakeConnection.stream.write = () => false
     spanStreamer.queue_size = 1
     const metrics = spanStreamer._metrics
 
-    t.equal(spanStreamer.spans.length, 0, 'no spans queued')
+    assert.equal(spanStreamer.spans.length, 0, 'no spans queued')
     const fakeSpan = {
       toStreamingFormat: () => {}
     }
@@ -82,34 +81,33 @@ tap.test('BatchSpanStreamer', (t) => {
     spanStreamer.write(fakeSpan)
     spanStreamer.write(fakeSpan)
 
-    t.equal(spanStreamer.spans.length, 1, 'one span queued')
+    assert.equal(spanStreamer.spans.length, 1, 'one span queued')
 
     /* emit drain event and allow writes */
     spanStreamer.stream.emit('drain', (fakeConnection.stream.write = () => true))
 
-    t.equal(spanStreamer.spans.length, 0, 'drained spans')
-    t.equal(
+    assert.equal(spanStreamer.spans.length, 0, 'drained spans')
+    assert.equal(
       metrics.getOrCreateMetric(METRIC_NAMES.INFINITE_TRACING.DRAIN_DURATION).callCount,
       1,
       'DRAIN_DURATION metric'
     )
 
-    t.equal(
+    assert.equal(
       metrics.getOrCreateMetric(METRIC_NAMES.INFINITE_TRACING.SENT).callCount,
       2,
       'SENT metric incremented'
     )
-
-    t.end()
   })
 
-  t.test('Should properly format spans sent from the queue', (t) => {
+  await t.test('Should properly format spans sent from the queue', (t) => {
+    const { fakeConnection, spanStreamer } = t.nr
     /* simulate backpressure */
     fakeConnection.stream.write = () => false
     spanStreamer.queue_size = 1
     const metrics = spanStreamer._metrics
 
-    t.equal(spanStreamer.spans.length, 0, 'no spans queued')
+    assert.equal(spanStreamer.spans.length, 0, 'no spans queued')
 
     const fakeSpan = new SpanStreamerEvent('sandwich', {}, {})
     const fakeSpanQueued = new SpanStreamerEvent('porridge', {}, {})
@@ -117,37 +115,35 @@ tap.test('BatchSpanStreamer', (t) => {
     spanStreamer.write(fakeSpan)
     spanStreamer.write(fakeSpanQueued)
 
-    t.equal(spanStreamer.spans.length, 1, 'one span queued')
+    assert.equal(spanStreamer.spans.length, 1, 'one span queued')
 
     // emit drain event, allow writes and check for span.trace_id
     fakeConnection.stream.emit(
       'drain',
       (fakeConnection.stream.write = ({ spans }) => {
         const [span] = spans
-        t.equal(span.trace_id, 'porridge', 'Should have formatted span')
+        assert.equal(span.trace_id, 'porridge', 'Should have formatted span')
 
         return true
       })
     )
 
-    t.equal(spanStreamer.spans.length, 0, 'drained spans')
-    t.equal(
+    assert.equal(spanStreamer.spans.length, 0, 'drained spans')
+    assert.equal(
       metrics.getOrCreateMetric(METRIC_NAMES.INFINITE_TRACING.DRAIN_DURATION).callCount,
       1,
       'DRAIN_DURATION metric'
     )
 
-    t.equal(
+    assert.equal(
       metrics.getOrCreateMetric(METRIC_NAMES.INFINITE_TRACING.SENT).callCount,
       2,
       'SENT metric incremented'
     )
-
-    t.end()
   })
 
-  t.test('should send a batch if it exceeds queue', (t) => {
-    t.plan(11)
+  await t.test('should send a batch if it exceeds queue', (t, end) => {
+    const { fakeConnection, spanStreamer } = t.nr
     const metrics = spanStreamer._metrics
 
     let i = 0
@@ -155,18 +151,19 @@ tap.test('BatchSpanStreamer', (t) => {
       i++
       if (i === 1) {
         const [span, span2] = spans
-        t.equal(span.trace_id, 'sandwich', 'batch 1 span 1 ok')
-        t.equal(span2.trace_id, 'porridge', 'batch 1 span 2 ok')
+        assert.equal(span.trace_id, 'sandwich', 'batch 1 span 1 ok')
+        assert.equal(span2.trace_id, 'porridge', 'batch 1 span 2 ok')
       } else {
         const [span, span2] = spans
-        t.equal(span.trace_id, 'arepa', 'batch 2 span 1 ok')
-        t.equal(span2.trace_id, 'hummus', 'batch 2 span 2 ok')
+        assert.equal(span.trace_id, 'arepa', 'batch 2 span 1 ok')
+        assert.equal(span2.trace_id, 'hummus', 'batch 2 span 2 ok')
+        end()
       }
 
       return true
     }
 
-    t.equal(spanStreamer.spans.length, 0, 'no spans queued')
+    assert.equal(spanStreamer.spans.length, 0, 'no spans queued')
 
     const fakeSpan = new SpanStreamerEvent('sandwich', {}, {})
     const fakeSpan2 = new SpanStreamerEvent('porridge', {}, {})
@@ -174,12 +171,12 @@ tap.test('BatchSpanStreamer', (t) => {
     const fakeSpan4 = new SpanStreamerEvent('hummus', {}, {})
 
     spanStreamer.write(fakeSpan)
-    t.equal(spanStreamer.spans.length, 1, '1 span in queue')
+    assert.equal(spanStreamer.spans.length, 1, '1 span in queue')
 
     spanStreamer.write(fakeSpan2)
 
-    t.equal(spanStreamer.spans.length, 0, '0 spans in queue')
-    t.equal(
+    assert.equal(spanStreamer.spans.length, 0, '0 spans in queue')
+    assert.equal(
       metrics.getOrCreateMetric(METRIC_NAMES.INFINITE_TRACING.SENT).callCount,
       2,
       'SENT metric incremented to 2'
@@ -187,33 +184,32 @@ tap.test('BatchSpanStreamer', (t) => {
 
     spanStreamer.write(fakeSpan3)
 
-    t.equal(spanStreamer.spans.length, 1, '1 span in queue')
+    assert.equal(spanStreamer.spans.length, 1, '1 span in queue')
 
     spanStreamer.write(fakeSpan4)
 
-    t.equal(spanStreamer.spans.length, 0, '0 spans in queue')
-    t.equal(
+    assert.equal(spanStreamer.spans.length, 0, '0 spans in queue')
+    assert.equal(
       metrics.getOrCreateMetric(METRIC_NAMES.INFINITE_TRACING.SENT).callCount,
       4,
       'SENT metric incremented to 4'
     )
   })
 
-  t.test('should send in appropriate batch sizes', (t) => {
-    t.comment('this will simulate n full batches and the last batch being 1/3 full')
+  await t.test('should send in appropriate batch sizes', (t) => {
+    const { fakeConnection, spanStreamer } = t.nr
+    t.diagnostic('this will simulate n full batches and the last batch being 1/3 full')
     const SPANS = 10000
     const BATCH = 750
-    // set the number of expected assertions to the batches + the sent metric
-    t.plan(Math.ceil(SPANS / BATCH) + 1)
     const metrics = spanStreamer._metrics
     spanStreamer.batchSize = BATCH
     spanStreamer.queue_size = SPANS
     let i = 0
     fakeConnection.stream.write = ({ spans }) => {
       if (i === 13) {
-        t.equal(spans.length, BATCH / 3)
+        assert.equal(spans.length, BATCH / 3)
       } else {
-        t.equal(spans.length, BATCH)
+        assert.equal(spans.length, BATCH)
       }
       i++
       return true
@@ -223,11 +219,10 @@ tap.test('BatchSpanStreamer', (t) => {
     spans.forEach((span) => {
       spanStreamer.write(span)
     })
-    t.equal(
+    assert.equal(
       metrics.getOrCreateMetric(METRIC_NAMES.INFINITE_TRACING.SENT).callCount,
       SPANS,
       `SENT metric incremented to ${SPANS}`
     )
-    t.end()
   })
 })
diff --git a/test/unit/spans/create-span-event-aggregator.test.js b/test/unit/spans/create-span-event-aggregator.test.js
index 742309dc53..366faeda27 100644
--- a/test/unit/spans/create-span-event-aggregator.test.js
+++ b/test/unit/spans/create-span-event-aggregator.test.js
@@ -4,8 +4,8 @@
  */
 
 'use strict'
-
-const tap = require('tap')
+const assert = require('node:assert')
+const test = require('node:test')
 const Config = require('../../../lib/config')
 const SpanEventAggregator = require('../../../lib/spans/span-event-aggregator')
 const StreamingSpanEventAggregator = require('../../../lib/spans/streaming-span-event-aggregator')
@@ -27,16 +27,14 @@ const agent = {
   harvester: harvesterStub
 }
 
-tap.test('should return standard when trace observer not configured', (t) => {
+test('should return standard when trace observer not configured', async () => {
   const config = Config.initialize({})
 
   const aggregator = createSpanEventAggregator(config, agent)
-  assertStandardSpanAggregator(t, aggregator)
-
-  t.end()
+  assertStandardSpanAggregator(aggregator)
 })
 
-tap.test('should return standard when in serverless mode, trace observer valid', (t) => {
+test('should return standard when in serverless mode, trace observer valid', async () => {
   const config = Config.initialize({
     serverless_mode: { enabled: true },
     infinite_tracing: {
@@ -47,12 +45,10 @@ tap.test('should return standard when in serverless mode, trace observer valid',
   })
 
   const aggregator = createSpanEventAggregator(config, agent)
-  assertStandardSpanAggregator(t, aggregator)
-
-  t.end()
+  assertStandardSpanAggregator(aggregator)
 })
 
-tap.test('should return streaming when trace observer configured', (t) => {
+test('should return streaming when trace observer configured', async () => {
   const config = Config.initialize({
     infinite_tracing: {
       trace_observer: {
@@ -64,12 +60,10 @@ tap.test('should return streaming when trace observer configured', (t) => {
   const aggregator = createSpanEventAggregator(config, agent)
   const isStreamingAggregator = aggregator instanceof StreamingSpanEventAggregator
 
-  t.ok(isStreamingAggregator)
-
-  t.end()
+  assert.ok(isStreamingAggregator)
 })
 
-tap.test('should create batching streamer when batching is enabled', (t) => {
+test('should create batching streamer when batching is enabled', async () => {
   metricsStub.getOrCreateMetric.resetHistory()
   const config = Config.initialize({
     infinite_tracing: {
@@ -82,17 +76,16 @@ tap.test('should create batching streamer when batching is enabled', (t) => {
 
   const aggregator = createSpanEventAggregator(config, agent)
   const isBatchStreamer = aggregator.stream instanceof BatchSpanStreamer
-  t.ok(isBatchStreamer)
-  t.ok(metricsStub.getOrCreateMetric.args[0].length === 1, 'should have only 1 metric set')
-  t.ok(
+  assert.ok(isBatchStreamer)
+  assert.ok(metricsStub.getOrCreateMetric.args[0].length === 1, 'should have only 1 metric set')
+  assert.ok(
     metricsStub.getOrCreateMetric.args[0][0],
     'Supportability/InfiniteTracing/gRPC/Batching/enabled',
     'should set batching enabled supportability metric'
   )
-  t.end()
 })
 
-tap.test('should create span streamer when batching is disabled', (t) => {
+test('should create span streamer when batching is disabled', async () => {
   metricsStub.getOrCreateMetric.resetHistory()
   const config = Config.initialize({
     infinite_tracing: {
@@ -105,17 +98,16 @@ tap.test('should create span streamer when batching is disabled', (t) => {
 
   const aggregator = createSpanEventAggregator(config, agent)
   const isSpanStreamer = aggregator.stream instanceof SpanStreamer
-  t.ok(isSpanStreamer)
-  t.ok(metricsStub.getOrCreateMetric.args[0].length === 1, 'should have only 1 metric set')
-  t.ok(
+  assert.ok(isSpanStreamer)
+  assert.ok(metricsStub.getOrCreateMetric.args[0].length === 1, 'should have only 1 metric set')
+  assert.ok(
     metricsStub.getOrCreateMetric.args[0][0],
     'Supportability/InfiniteTracing/gRPC/Batching/disaabled',
     'should set batching disabled supportability metric'
   )
-  t.end()
 })
 
-tap.test('should trim host and port options when they are strings', (t) => {
+test('should trim host and port options when they are strings', async () => {
   const config = Config.initialize({
     infinite_tracing: {
       trace_observer: {
@@ -126,62 +118,55 @@ tap.test('should trim host and port options when they are strings', (t) => {
   })
 
   createSpanEventAggregator(config, agent)
-  t.same(config.infinite_tracing.trace_observer, {
+  assert.deepEqual(config.infinite_tracing.trace_observer, {
     host: VALID_HOST,
     port: '300'
   })
-
-  t.end()
 })
 
-tap.test(
-  'should revert to standard aggregator when it fails to create streaming aggregator',
-  (t) => {
-    const config = Config.initialize({
-      infinite_tracing: {
-        trace_observer: {
-          host: VALID_HOST
-        }
+test('should revert to standard aggregator when it fails to create streaming aggregator', () => {
+  const config = Config.initialize({
+    infinite_tracing: {
+      trace_observer: {
+        host: VALID_HOST
       }
-    })
-
-    const err = new Error('failed to craete streaming aggregator')
-    const stub = sinon.stub().throws(err)
-    const loggerStub = {
-      warn: sinon.stub(),
-      trace: sinon.stub()
     }
+  })
 
-    const createSpanAggrStubbed = proxyquire('../../../lib/spans/create-span-event-aggregator', {
-      './streaming-span-event-aggregator': stub,
-      '../logger': loggerStub
-    })
-
-    const aggregator = createSpanAggrStubbed(config, agent)
-    assertStandardSpanAggregator(t, aggregator)
-    t.same(
-      config.infinite_tracing.trace_observer,
-      { host: '', port: '' },
-      'should set host and port to empty strings when failing to create streaming aggregator'
-    )
-    t.same(
-      loggerStub.warn.args[0],
-      [
-        err,
-        'Failed to create streaming span event aggregator for infinite tracing. ' +
-          'Reverting to standard span event aggregator and disabling infinite tracing'
-      ],
-      'should log warning about failed streaming construction'
-    )
-
-    t.end()
+  const err = new Error('failed to craete streaming aggregator')
+  const stub = sinon.stub().throws(err)
+  const loggerStub = {
+    warn: sinon.stub(),
+    trace: sinon.stub()
   }
-)
 
-function assertStandardSpanAggregator(t, aggregator) {
+  const createSpanAggrStubbed = proxyquire('../../../lib/spans/create-span-event-aggregator', {
+    './streaming-span-event-aggregator': stub,
+    '../logger': loggerStub
+  })
+
+  const aggregator = createSpanAggrStubbed(config, agent)
+  assertStandardSpanAggregator(aggregator)
+  assert.deepEqual(
+    config.infinite_tracing.trace_observer,
+    { host: '', port: '' },
+    'should set host and port to empty strings when failing to create streaming aggregator'
+  )
+  assert.deepEqual(
+    loggerStub.warn.args[0],
+    [
+      err,
+      'Failed to create streaming span event aggregator for infinite tracing. ' +
+        'Reverting to standard span event aggregator and disabling infinite tracing'
+    ],
+    'should log warning about failed streaming construction'
+  )
+})
+
+function assertStandardSpanAggregator(aggregator) {
   const isSpanEventAggregator = aggregator instanceof SpanEventAggregator
   const isStreamingAggregator = aggregator instanceof StreamingSpanEventAggregator
 
-  t.ok(isSpanEventAggregator)
-  t.notOk(isStreamingAggregator)
+  assert.ok(isSpanEventAggregator)
+  assert.ok(!isStreamingAggregator)
 }
diff --git a/test/unit/spans/map-to-streaming-type.test.js b/test/unit/spans/map-to-streaming-type.test.js
index ffcc1a324b..d96ec4f7fc 100644
--- a/test/unit/spans/map-to-streaming-type.test.js
+++ b/test/unit/spans/map-to-streaming-type.test.js
@@ -4,101 +4,81 @@
  */
 
 'use strict'
-
-const tap = require('tap')
+const assert = require('node:assert')
+const test = require('node:test')
 
 const mapToStreamingType = require('../../../lib/spans/map-to-streaming-type')
 
-tap.test('should corectly convert strings', (t) => {
+test('should corectly convert strings', async () => {
   const stringValue = 'myString'
   const expected = {
     string_value: stringValue
   }
-
   const result = mapToStreamingType(stringValue)
-  t.same(result, expected)
-  t.end()
+  assert.deepEqual(result, expected)
 })
 
-tap.test('should not drop empty strings', (t) => {
+test('should not drop empty strings', async () => {
   const stringValue = ''
   const expected = {
     string_value: stringValue
   }
-
   const result = mapToStreamingType(stringValue)
-  t.same(result, expected)
-  t.end()
+  assert.deepEqual(result, expected)
 })
 
-tap.test('should correctly convert bools when true', (t) => {
+test('should correctly convert bools when true', async () => {
   const boolValue = true
   const expected = {
     bool_value: boolValue
   }
-
   const result = mapToStreamingType(boolValue)
-  t.same(result, expected)
-  t.end()
+  assert.deepEqual(result, expected)
 })
 
-tap.test('should correctly convert bools when false', (t) => {
+test('should correctly convert bools when false', async () => {
   const boolValue = false
   const expected = {
     bool_value: boolValue
   }
-
   const result = mapToStreamingType(boolValue)
-  t.same(result, expected)
-  t.end()
+  assert.deepEqual(result, expected)
 })
 
-tap.test('should correctly convert integers', (t) => {
+test('should correctly convert integers', async () => {
   const intValue = 9999999999999999
   const expected = {
     int_value: intValue
   }
-
   const result = mapToStreamingType(intValue)
-  t.same(result, expected)
-  t.end()
+  assert.deepEqual(result, expected)
 })
 
-tap.test('should correctly convert doubles', (t) => {
+test('should correctly convert doubles', async () => {
   const doubleValue = 999.99
   const expected = {
     double_value: doubleValue
   }
-
   const result = mapToStreamingType(doubleValue)
-  t.same(result, expected)
-  t.end()
+  assert.deepEqual(result, expected)
 })
 
-tap.test('should drop nulls', (t) => {
+test('should drop nulls', async () => {
   const result = mapToStreamingType(null)
-
-  t.equal(result, undefined)
-  t.end()
+  assert.equal(result, undefined)
 })
 
-tap.test('should drop undefined', (t) => {
+test('should drop undefined', async () => {
   const result = mapToStreamingType()
-
-  t.equal(result, undefined)
-  t.end()
+  assert.equal(result, undefined)
 })
 
-tap.test('should drop objects', (t) => {
+test('should drop objects', async () => {
   const result = mapToStreamingType({})
-
-  t.equal(result, undefined)
-  t.end()
+  assert.equal(result, undefined)
 })
 
-tap.test('should drop functions', (t) => {
+test('should drop functions', async () => {
   const result = mapToStreamingType(() => {})
-
-  t.equal(result, undefined)
-  t.end()
+  assert.equal(result, undefined)
 })
diff --git a/test/unit/spans/span-event-aggregator.test.js b/test/unit/spans/span-event-aggregator.test.js
index 105075fef4..6d5da42061 100644
--- a/test/unit/spans/span-event-aggregator.test.js
+++ b/test/unit/spans/span-event-aggregator.test.js
@@ -4,8 +4,8 @@
  */
 
 'use strict'
-
-const tap = require('tap')
+const assert = require('node:assert')
+const test = require('node:test')
 const sinon = require('sinon')
 
 const helper = require('../../lib/agent_helper')
@@ -17,14 +17,10 @@ const DEFAULT_LIMIT = 2000
 const MAX_LIMIT = 10000
 const DEFAULT_PERIOD = 60000
 
-tap.test('SpanAggregator', (t) => {
-  t.autoend()
-
-  let spanEventAggregator = null
-  let agent = null
-
-  t.beforeEach(() => {
-    spanEventAggregator = new SpanEventAggregator(
+test('SpanAggregator', async (t) => {
+  t.beforeEach((ctx) => {
+    ctx.nr = {}
+    ctx.nr.spanEventAggregator = new SpanEventAggregator(
       {
         runId: RUN_ID,
         limit: DEFAULT_LIMIT,
@@ -36,26 +32,25 @@ tap.test('SpanAggregator', (t) => {
         harvester: { add() {} }
       }
     )
-    agent = helper.instrumentMockedAgent({
+    ctx.nr.agent = helper.instrumentMockedAgent({
       distributed_tracing: {
         enabled: true
       }
     })
   })
 
-  t.afterEach(() => {
-    spanEventAggregator = null
-    helper.unloadAgent(agent)
+  t.afterEach((ctx) => {
+    helper.unloadAgent(ctx.nr.agent)
   })
 
-  t.test('should set the correct default method', (t) => {
+  await t.test('should set the correct default method', (t) => {
+    const { spanEventAggregator } = t.nr
     const method = spanEventAggregator.method
-    t.equal(method, 'span_event_data')
-
-    t.end()
+    assert.equal(method, 'span_event_data')
   })
 
-  t.test('should add a span event from the given segment', (t) => {
+  await t.test('should add a span event from the given segment', (t, end) => {
+    const { agent, spanEventAggregator } = t.nr
     helper.runInTransaction(agent, (tx) => {
       tx.priority = 42
       tx.sample = true
@@ -63,48 +58,50 @@ tap.test('SpanAggregator', (t) => {
       setTimeout(() => {
         const segment = agent.tracer.getSegment()
 
-        t.equal(spanEventAggregator.length, 0)
+        assert.equal(spanEventAggregator.length, 0)
 
         spanEventAggregator.addSegment(segment, 'p')
-        t.equal(spanEventAggregator.length, 1)
+        assert.equal(spanEventAggregator.length, 1)
 
         const event = spanEventAggregator.getEvents()[0]
 
-        t.ok(event.intrinsics)
-        t.equal(event.intrinsics.name, segment.name)
-        t.equal(event.intrinsics.parentId, 'p')
+        assert.ok(event.intrinsics)
+        assert.equal(event.intrinsics.name, segment.name)
+        assert.equal(event.intrinsics.parentId, 'p')
 
-        t.end()
+        end()
       }, 10)
     })
   })
 
-  t.test('should default the parent id', (t) => {
+  await t.test('should default the parent id', (t, end) => {
+    const { agent, spanEventAggregator } = t.nr
     helper.runInTransaction(agent, (tx) => {
       tx.priority = 42
       tx.sample = true
 
       setTimeout(() => {
         const segment = agent.tracer.getSegment()
-        t.equal(spanEventAggregator.length, 0)
+        assert.equal(spanEventAggregator.length, 0)
 
         spanEventAggregator.addSegment(segment)
-        t.equal(spanEventAggregator.length, 1)
+        assert.equal(spanEventAggregator.length, 1)
 
         const event = spanEventAggregator.getEvents()[0]
 
-        t.ok(event.intrinsics)
-        t.equal(event.intrinsics.name, segment.name)
-        t.equal(event.intrinsics.parentId, null)
+        assert.ok(event.intrinsics)
+        assert.equal(event.intrinsics.name, segment.name)
+        assert.equal(event.intrinsics.parentId, null)
 
-        t.notOk(event.intrinsics.grandparentId)
+        assert.ok(!event.intrinsics.grandparentId)
 
-        t.end()
+        end()
       }, 10)
     })
   })
 
-  t.test('should indicate if the segment is accepted', (t) => {
+  await t.test('should indicate if the segment is accepted', (t, end) => {
+    const { agent } = t.nr
     const METRIC_NAMES = {
       SEEN: '/SEEN',
       SENT: '/SENT',
@@ -113,7 +110,7 @@ tap.test('SpanAggregator', (t) => {
 
     const metrics = new Metrics(5, {}, {})
 
-    spanEventAggregator = new SpanEventAggregator(
+    const spanEventAggregator = new SpanEventAggregator(
       {
         runId: RUN_ID,
         limit: 1,
@@ -133,41 +130,42 @@ tap.test('SpanAggregator', (t) => {
       setTimeout(() => {
         const segment = agent.tracer.getSegment()
 
-        t.equal(spanEventAggregator.length, 0)
-        t.equal(spanEventAggregator.seen, 0)
+        assert.equal(spanEventAggregator.length, 0)
+        assert.equal(spanEventAggregator.seen, 0)
 
         // First segment is added regardless of priority.
-        t.equal(spanEventAggregator.addSegment(segment), true)
-        t.equal(spanEventAggregator.length, 1)
-        t.equal(spanEventAggregator.seen, 1)
+        assert.equal(spanEventAggregator.addSegment(segment), true)
+        assert.equal(spanEventAggregator.length, 1)
+        assert.equal(spanEventAggregator.seen, 1)
 
         // Higher priority should be added.
         tx.priority = 100
-        t.equal(spanEventAggregator.addSegment(segment), true)
-        t.equal(spanEventAggregator.length, 1)
-        t.equal(spanEventAggregator.seen, 2)
+        assert.equal(spanEventAggregator.addSegment(segment), true)
+        assert.equal(spanEventAggregator.length, 1)
+        assert.equal(spanEventAggregator.seen, 2)
         const event1 = spanEventAggregator.getEvents()[0]
 
         // Lower priority should not be added.
         tx.priority = 1
-        t.equal(spanEventAggregator.addSegment(segment), false)
-        t.equal(spanEventAggregator.length, 1)
-        t.equal(spanEventAggregator.seen, 3)
+        assert.equal(spanEventAggregator.addSegment(segment), false)
+        assert.equal(spanEventAggregator.length, 1)
+        assert.equal(spanEventAggregator.seen, 3)
         const event2 = spanEventAggregator.getEvents()[0]
 
         const metric = metrics.getMetric(METRIC_NAMES.SEEN)
 
-        t.equal(metric.callCount, 3)
+        assert.equal(metric.callCount, 3)
 
         // Shouldn't change the event in the aggregator.
-        t.equal(event1, event2)
+        assert.equal(event1, event2)
 
-        t.end()
+        end()
       }, 10)
     })
   })
 
-  t.test('_toPayloadSync() should return json format of data', (t) => {
+  await t.test('_toPayloadSync() should return json format of data', (t, end) => {
+    const { agent, spanEventAggregator } = t.nr
     helper.runInTransaction(agent, (tx) => {
       tx.priority = 1
       tx.sample = true
@@ -181,23 +179,24 @@ tap.test('SpanAggregator', (t) => {
 
         const [runId, metrics, events] = payload
 
-        t.equal(runId, RUN_ID)
+        assert.equal(runId, RUN_ID)
 
-        t.ok(metrics.reservoir_size)
-        t.ok(metrics.events_seen)
-        t.equal(metrics.reservoir_size, DEFAULT_LIMIT)
-        t.equal(metrics.events_seen, 1)
+        assert.ok(metrics.reservoir_size)
+        assert.ok(metrics.events_seen)
+        assert.equal(metrics.reservoir_size, DEFAULT_LIMIT)
+        assert.equal(metrics.events_seen, 1)
 
-        t.ok(events[0])
-        t.ok(events[0].intrinsics)
-        t.equal(events[0].intrinsics.type, 'Span')
+        assert.ok(events[0])
+        assert.ok(events[0].intrinsics)
+        assert.equal(events[0].intrinsics.type, 'Span')
 
-        t.end()
+        end()
       }, 10)
     })
   })
 
-  t.test('should use default value for periodMs', (t) => {
+  await t.test('should use default value for periodMs', (t) => {
+    const { spanEventAggregator } = t.nr
     const fakeConfig = {
       getAggregatorConfig: sinon.stub().returns(null),
       span_events: {
@@ -205,16 +204,15 @@ tap.test('SpanAggregator', (t) => {
       }
     }
     spanEventAggregator.reconfigure(fakeConfig)
-    t.equal(
+    assert.equal(
       spanEventAggregator.periodMs,
       DEFAULT_PERIOD,
       `should default periodMs to ${DEFAULT_PERIOD}`
     )
-
-    t.end()
   })
 
-  t.test('should use default value for limit when user cleared', (t) => {
+  await t.test('should use default value for limit when user cleared', (t) => {
+    const { spanEventAggregator } = t.nr
     const fakeConfig = {
       getAggregatorConfig: sinon.stub().returns(null),
       span_events: {
@@ -225,16 +223,20 @@ tap.test('SpanAggregator', (t) => {
 
     spanEventAggregator.reconfigure(fakeConfig)
 
-    t.equal(spanEventAggregator.limit, DEFAULT_LIMIT, `should default limit to ${DEFAULT_LIMIT}`)
-    t.equal(
+    assert.equal(
+      spanEventAggregator.limit,
+      DEFAULT_LIMIT,
+      `should default limit to ${DEFAULT_LIMIT}`
+    )
+    assert.equal(
       spanEventAggregator._items.limit,
       DEFAULT_LIMIT,
       `should set queue limit to ${DEFAULT_LIMIT}`
     )
-    t.end()
   })
 
-  t.test('should use `span_event_harvest_config.report_period_ms` from server', (t) => {
+  await t.test('should use `span_event_harvest_config.report_period_ms` from server', (t) => {
+    const { spanEventAggregator } = t.nr
     const fakeConfig = {
       span_event_harvest_config: {
         report_period_ms: 4000,
@@ -247,15 +249,15 @@ tap.test('SpanAggregator', (t) => {
     }
     spanEventAggregator.reconfigure(fakeConfig)
 
-    t.equal(
+    assert.equal(
       spanEventAggregator.periodMs,
       4000,
       `should use span_event_harvest_config.report_period_ms`
     )
-    t.end()
   })
 
-  t.test(`should use 'span_event_harvest_config.harvest_limit' from server`, (t) => {
+  await t.test(`should use 'span_event_harvest_config.harvest_limit' from server`, (t) => {
+    const { spanEventAggregator } = t.nr
     const fakeConfig = {
       span_event_harvest_config: {
         harvest_limit: 2000
@@ -266,12 +268,16 @@ tap.test('SpanAggregator', (t) => {
       }
     }
     spanEventAggregator.reconfigure(fakeConfig)
-    t.equal(spanEventAggregator.limit, 2000, 'should use span_event_harvest_config.harvest_limit')
-    t.equal(spanEventAggregator._items.limit, 2000, `should set queue limit`)
-    t.end()
+    assert.equal(
+      spanEventAggregator.limit,
+      2000,
+      'should use span_event_harvest_config.harvest_limit'
+    )
+    assert.equal(spanEventAggregator._items.limit, 2000, `should set queue limit`)
   })
 
-  t.test(`should use 'span_event_harvest_config.harvest_limit' from server`, (t) => {
+  await t.test(`should use 'span_event_harvest_config.harvest_limit' from server`, (t) => {
+    const { spanEventAggregator } = t.nr
     const fakeConfig = {
       span_event_harvest_config: {
         harvest_limit: 2000
@@ -282,12 +288,16 @@ tap.test('SpanAggregator', (t) => {
       }
     }
     spanEventAggregator.reconfigure(fakeConfig)
-    t.equal(spanEventAggregator.limit, 2000, 'should use span_event_harvest_config.harvest_limit')
-    t.equal(spanEventAggregator._items.limit, 2000, `should set queue limit`)
-    t.end()
+    assert.equal(
+      spanEventAggregator.limit,
+      2000,
+      'should use span_event_harvest_config.harvest_limit'
+    )
+    assert.equal(spanEventAggregator._items.limit, 2000, `should set queue limit`)
   })
 
-  t.test('should use max_samples_stored as-is when no span harvest config', (t) => {
+  await t.test('should use max_samples_stored as-is when no span harvest config', (t) => {
+    const { spanEventAggregator } = t.nr
     const expectedLimit = 5000
     const fakeConfig = {
       getAggregatorConfig: sinon.stub().returns(null),
@@ -298,12 +308,12 @@ tap.test('SpanAggregator', (t) => {
 
     spanEventAggregator.reconfigure(fakeConfig)
 
-    t.equal(spanEventAggregator.limit, expectedLimit)
-    t.equal(spanEventAggregator._items.limit, expectedLimit)
-    t.end()
+    assert.equal(spanEventAggregator.limit, expectedLimit)
+    assert.equal(spanEventAggregator._items.limit, expectedLimit)
   })
 
-  t.test('should use fall-back maximum when no span harvest config sent', (t) => {
+  await t.test('should use fall-back maximum when no span harvest config sent', (t) => {
+    const { spanEventAggregator } = t.nr
     const maxSamples = 20000
     const fakeConfig = {
       getAggregatorConfig: sinon.stub().returns(null),
@@ -312,14 +322,14 @@ tap.test('SpanAggregator', (t) => {
       }
     }
 
-    t.ok(maxSamples > MAX_LIMIT, 'failed test setup expectations')
+    assert.ok(maxSamples > MAX_LIMIT, 'failed test setup expectations')
 
     spanEventAggregator.reconfigure(fakeConfig)
-    t.equal(spanEventAggregator.limit, MAX_LIMIT, `should set limit to ${MAX_LIMIT}`)
-    t.end()
+    assert.equal(spanEventAggregator.limit, MAX_LIMIT, `should set limit to ${MAX_LIMIT}`)
   })
 
-  t.test('should report SpanEvent/Limit supportability metric', (t) => {
+  await t.test('should report SpanEvent/Limit supportability metric', (t) => {
+    const { spanEventAggregator } = t.nr
     const recordValueStub = sinon.stub()
     spanEventAggregator._metrics.getOrCreateMetric = sinon
       .stub()
@@ -334,12 +344,11 @@ tap.test('SpanAggregator', (t) => {
 
     spanEventAggregator.reconfigure(fakeConfig)
 
-    t.equal(
+    assert.equal(
       spanEventAggregator._metrics.getOrCreateMetric.args[0][0],
       'Supportability/SpanEvent/Limit',
       'should name event appropriately'
     )
-    t.equal(recordValueStub.args[0][0], harvestLimit, `should set limit to ${harvestLimit}`)
-    t.end()
+    assert.equal(recordValueStub.args[0][0], harvestLimit, `should set limit to ${harvestLimit}`)
   })
 })
diff --git a/test/unit/spans/span-event.test.js b/test/unit/spans/span-event.test.js
index 0292e7b3e6..2629bf42e8 100644
--- a/test/unit/spans/span-event.test.js
+++ b/test/unit/spans/span-event.test.js
@@ -4,8 +4,8 @@
  */
 
 'use strict'
-
-const tap = require('tap')
+const assert = require('node:assert')
+const test = require('node:test')
 const DatastoreShim = require('../../../lib/shim/datastore-shim')
 const helper = require('../../lib/agent_helper')
 const https = require('https')
@@ -13,17 +13,17 @@ const SpanEvent = require('../../../lib/spans/span-event')
 const DatastoreParameters = require('../../../lib/shim/specs/params/datastore')
 const { QuerySpec } = require('../../../lib/shim/specs')
 
-tap.test('#constructor() should construct an empty span event', (t) => {
+test('#constructor() should construct an empty span event', () => {
   const attrs = {}
   const span = new SpanEvent(attrs)
 
-  t.ok(span)
-  t.ok(span instanceof SpanEvent)
-  t.equal(span.attributes, attrs)
+  assert.ok(span)
+  assert.ok(span instanceof SpanEvent)
+  assert.equal(span.attributes, attrs)
 
-  t.ok(span.intrinsics)
-  t.equal(span.intrinsics.type, 'Span')
-  t.equal(span.intrinsics.category, SpanEvent.CATEGORIES.GENERIC)
+  assert.ok(span.intrinsics)
+  assert.equal(span.intrinsics.type, 'Span')
+  assert.equal(span.intrinsics.category, SpanEvent.CATEGORIES.GENERIC)
 
   const emptyProps = [
     'traceId',
@@ -37,30 +37,26 @@ tap.test('#constructor() should construct an empty span event', (t) => {
     'duration'
   ]
   emptyProps.forEach((prop) => {
-    t.equal(span.intrinsics[prop], null)
+    assert.equal(span.intrinsics[prop], null)
   })
-
-  t.end()
 })
 
-tap.test('fromSegment()', (t) => {
-  t.autoend()
-
-  let agent = null
-
-  t.beforeEach(() => {
-    agent = helper.instrumentMockedAgent({
+test('fromSegment()', async (t) => {
+  t.beforeEach((ctx) => {
+    ctx.nr = {}
+    ctx.nr.agent = helper.instrumentMockedAgent({
       distributed_tracing: {
         enabled: true
       }
     })
   })
 
-  t.afterEach(() => {
-    helper.unloadAgent(agent)
+  t.afterEach((ctx) => {
+    helper.unloadAgent(ctx.nr.agent)
   })
 
-  t.test('should create a generic span with a random segment', (t) => {
+  await t.test('should create a generic span with a random segment', (t, end) => {
+    const { agent } = t.nr
     helper.runInTransaction(agent, (transaction) => {
       transaction.sampled = true
       transaction.priority = 42
@@ -77,60 +73,61 @@ tap.test('fromSegment()', (t) => {
         const span = SpanEvent.fromSegment(segment, 'parent')
 
         // Should have all the normal properties.
-        t.ok(span)
-        t.ok(span instanceof SpanEvent)
+        assert.ok(span)
+        assert.ok(span instanceof SpanEvent)
 
-        t.ok(span.intrinsics)
-        t.equal(span.intrinsics.type, 'Span')
-        t.equal(span.intrinsics.category, SpanEvent.CATEGORIES.GENERIC)
+        assert.ok(span.intrinsics)
+        assert.equal(span.intrinsics.type, 'Span')
+        assert.equal(span.intrinsics.category, SpanEvent.CATEGORIES.GENERIC)
 
-        t.equal(span.intrinsics.traceId, transaction.traceId)
-        t.equal(span.intrinsics.guid, segment.id)
-        t.equal(span.intrinsics.parentId, 'parent')
-        t.equal(span.intrinsics.transactionId, transaction.id)
-        t.equal(span.intrinsics.sampled, true)
-        t.equal(span.intrinsics.priority, 42)
-        t.equal(span.intrinsics.name, 'timers.setTimeout')
-        t.equal(span.intrinsics.timestamp, segment.timer.start)
+        assert.equal(span.intrinsics.traceId, transaction.traceId)
+        assert.equal(span.intrinsics.guid, segment.id)
+        assert.equal(span.intrinsics.parentId, 'parent')
+        assert.equal(span.intrinsics.transactionId, transaction.id)
+        assert.equal(span.intrinsics.sampled, true)
+        assert.equal(span.intrinsics.priority, 42)
+        assert.equal(span.intrinsics.name, 'timers.setTimeout')
+        assert.equal(span.intrinsics.timestamp, segment.timer.start)
 
-        t.ok(span.intrinsics.duration >= 0.03 && span.intrinsics.duration <= 0.3)
+        assert.ok(span.intrinsics.duration >= 0.03 && span.intrinsics.duration <= 0.3)
 
         // Generic should not have 'span.kind' or 'component'
-        t.equal(span.intrinsics['span.kind'], null)
-        t.equal(span.intrinsics.component, null)
+        assert.equal(span.intrinsics['span.kind'], null)
+        assert.equal(span.intrinsics.component, null)
 
-        t.ok(span.customAttributes)
+        assert.ok(span.customAttributes)
         const customAttributes = span.customAttributes
 
-        t.ok(customAttributes['Span Lee'])
+        assert.ok(customAttributes['Span Lee'])
 
-        t.ok(span.attributes)
+        assert.ok(span.attributes)
         const attributes = span.attributes
 
         const hasOwnAttribute = Object.hasOwnProperty.bind(attributes)
 
-        t.ok(hasOwnAttribute('SpiderSpan'), 'Should have attribute added through segment')
-        t.equal(attributes['server.address'], 'my-host')
-        t.equal(attributes['server.port'], 222)
+        assert.ok(hasOwnAttribute('SpiderSpan'), 'Should have attribute added through segment')
+        assert.equal(attributes['server.address'], 'my-host')
+        assert.equal(attributes['server.port'], 222)
 
         // Should have no http properties.
-        t.notOk(hasOwnAttribute('externalLibrary'))
-        t.notOk(hasOwnAttribute('externalUri'))
-        t.notOk(hasOwnAttribute('externalProcedure'))
+        assert.ok(!hasOwnAttribute('externalLibrary'))
+        assert.ok(!hasOwnAttribute('externalUri'))
+        assert.ok(!hasOwnAttribute('externalProcedure'))
 
         // Should have no datastore properties.
-        t.notOk(hasOwnAttribute('db.statement'))
-        t.notOk(hasOwnAttribute('db.instance'))
-        t.notOk(hasOwnAttribute('db.system'))
-        t.notOk(hasOwnAttribute('peer.hostname'))
-        t.notOk(hasOwnAttribute('peer.address'))
+        assert.ok(!hasOwnAttribute('db.statement'))
+        assert.ok(!hasOwnAttribute('db.instance'))
+        assert.ok(!hasOwnAttribute('db.system'))
+        assert.ok(!hasOwnAttribute('peer.hostname'))
+        assert.ok(!hasOwnAttribute('peer.address'))
 
-        t.end()
+        end()
       }, 50)
     })
   })
 
-  t.test('should create an http span with a external segment', (t) => {
+  await t.test('should create an http span with a external segment', (t, end) => {
+    const { agent } = t.nr
     helper.runInTransaction(agent, (transaction) => {
       transaction.sampled = true
       transaction.priority = 42
@@ -142,64 +139,65 @@ tap.test('fromSegment()', (t) => {
           const span = SpanEvent.fromSegment(segment, 'parent')
 
           // Should have all the normal properties.
-          t.ok(span)
-          t.ok(span instanceof SpanEvent)
-          t.ok(span instanceof SpanEvent.HttpSpanEvent)
+          assert.ok(span)
+          assert.ok(span instanceof SpanEvent)
+          assert.ok(span instanceof SpanEvent.HttpSpanEvent)
 
-          t.ok(span.intrinsics)
-          t.equal(span.intrinsics.type, 'Span')
-          t.equal(span.intrinsics.category, SpanEvent.CATEGORIES.HTTP)
+          assert.ok(span.intrinsics)
+          assert.equal(span.intrinsics.type, 'Span')
+          assert.equal(span.intrinsics.category, SpanEvent.CATEGORIES.HTTP)
 
-          t.equal(span.intrinsics.traceId, transaction.traceId)
-          t.equal(span.intrinsics.guid, segment.id)
-          t.equal(span.intrinsics.parentId, 'parent')
-          t.equal(span.intrinsics.transactionId, transaction.id)
-          t.equal(span.intrinsics.sampled, true)
-          t.equal(span.intrinsics.priority, 42)
+          assert.equal(span.intrinsics.traceId, transaction.traceId)
+          assert.equal(span.intrinsics.guid, segment.id)
+          assert.equal(span.intrinsics.parentId, 'parent')
+          assert.equal(span.intrinsics.transactionId, transaction.id)
+          assert.equal(span.intrinsics.sampled, true)
+          assert.equal(span.intrinsics.priority, 42)
 
-          t.equal(span.intrinsics.name, 'External/example.com/')
-          t.equal(span.intrinsics.timestamp, segment.timer.start)
+          assert.equal(span.intrinsics.name, 'External/example.com/')
+          assert.equal(span.intrinsics.timestamp, segment.timer.start)
 
-          t.ok(span.intrinsics.duration >= 0.01 && span.intrinsics.duration <= 2)
+          assert.ok(span.intrinsics.duration >= 0.01 && span.intrinsics.duration <= 2)
 
           // Should have type-specific intrinsics
-          t.equal(span.intrinsics.component, 'http')
-          t.equal(span.intrinsics['span.kind'], 'client')
+          assert.equal(span.intrinsics.component, 'http')
+          assert.equal(span.intrinsics['span.kind'], 'client')
 
-          t.ok(span.attributes)
+          assert.ok(span.attributes)
           const attributes = span.attributes
 
           // Should have (most) http properties.
-          t.equal(attributes['http.url'], 'https://example.com/')
-          t.equal(attributes['server.address'], 'example.com')
-          t.equal(attributes['server.port'], 443)
-          t.ok(attributes['http.method'])
-          t.ok(attributes['http.request.method'])
-          t.equal(attributes['http.statusCode'], 200)
-          t.equal(attributes['http.statusText'], 'OK')
+          assert.equal(attributes['http.url'], 'https://example.com/')
+          assert.equal(attributes['server.address'], 'example.com')
+          assert.equal(attributes['server.port'], 443)
+          assert.ok(attributes['http.method'])
+          assert.ok(attributes['http.request.method'])
+          assert.equal(attributes['http.statusCode'], 200)
+          assert.equal(attributes['http.statusText'], 'OK')
 
           // should nullify mapped properties
-          t.notOk(attributes.library)
-          t.notOk(attributes.url)
-          t.notOk(attributes.hostname)
-          t.notOk(attributes.port)
-          t.notOk(attributes.procedure)
+          assert.ok(!attributes.library)
+          assert.ok(!attributes.url)
+          assert.ok(!attributes.hostname)
+          assert.ok(!attributes.port)
+          assert.ok(!attributes.procedure)
 
           // Should have no datastore properties.
           const hasOwnAttribute = Object.hasOwnProperty.bind(attributes)
-          t.notOk(hasOwnAttribute('db.statement'))
-          t.notOk(hasOwnAttribute('db.instance'))
-          t.notOk(hasOwnAttribute('db.system'))
-          t.notOk(hasOwnAttribute('peer.hostname'))
-          t.notOk(hasOwnAttribute('peer.address'))
+          assert.ok(!hasOwnAttribute('db.statement'))
+          assert.ok(!hasOwnAttribute('db.instance'))
+          assert.ok(!hasOwnAttribute('db.system'))
+          assert.ok(!hasOwnAttribute('peer.hostname'))
+          assert.ok(!hasOwnAttribute('peer.address'))
 
-          t.end()
+          end()
         })
       })
     })
   })
 
-  t.test('should create a datastore span with a datastore segment', (t) => {
+  await t.test('should create a datastore span with a datastore segment', (t, end) => {
+    const { agent } = t.nr
     agent.config.transaction_tracer.record_sql = 'raw'
 
     const shim = new DatastoreShim(agent, 'test-data-store')
@@ -243,61 +241,62 @@ tap.test('fromSegment()', (t) => {
         const span = SpanEvent.fromSegment(segment, 'parent')
 
         // Should have all the normal properties.
-        t.ok(span)
-        t.ok(span instanceof SpanEvent)
-        t.ok(span instanceof SpanEvent.DatastoreSpanEvent)
+        assert.ok(span)
+        assert.ok(span instanceof SpanEvent)
+        assert.ok(span instanceof SpanEvent.DatastoreSpanEvent)
 
-        t.ok(span.intrinsics)
-        t.equal(span.intrinsics.type, 'Span')
-        t.equal(span.intrinsics.category, SpanEvent.CATEGORIES.DATASTORE)
+        assert.ok(span.intrinsics)
+        assert.equal(span.intrinsics.type, 'Span')
+        assert.equal(span.intrinsics.category, SpanEvent.CATEGORIES.DATASTORE)
 
-        t.equal(span.intrinsics.traceId, transaction.traceId)
-        t.equal(span.intrinsics.guid, segment.id)
-        t.equal(span.intrinsics.parentId, 'parent')
-        t.equal(span.intrinsics.transactionId, transaction.id)
-        t.equal(span.intrinsics.sampled, true)
-        t.equal(span.intrinsics.priority, 42)
+        assert.equal(span.intrinsics.traceId, transaction.traceId)
+        assert.equal(span.intrinsics.guid, segment.id)
+        assert.equal(span.intrinsics.parentId, 'parent')
+        assert.equal(span.intrinsics.transactionId, transaction.id)
+        assert.equal(span.intrinsics.sampled, true)
+        assert.equal(span.intrinsics.priority, 42)
 
-        t.equal(span.intrinsics.name, 'Datastore/statement/TestStore/test/test')
-        t.equal(span.intrinsics.timestamp, segment.timer.start)
+        assert.equal(span.intrinsics.name, 'Datastore/statement/TestStore/test/test')
+        assert.equal(span.intrinsics.timestamp, segment.timer.start)
 
-        t.ok(span.intrinsics.duration >= 0.03 && span.intrinsics.duration <= 0.7)
+        assert.ok(span.intrinsics.duration >= 0.03 && span.intrinsics.duration <= 0.7)
 
         // Should have (most) type-specific intrinsics
-        t.equal(span.intrinsics.component, 'TestStore')
-        t.equal(span.intrinsics['span.kind'], 'client')
+        assert.equal(span.intrinsics.component, 'TestStore')
+        assert.equal(span.intrinsics['span.kind'], 'client')
 
-        t.ok(span.attributes)
+        assert.ok(span.attributes)
         const attributes = span.attributes
 
         // Should have not http properties.
         const hasOwnAttribute = Object.hasOwnProperty.bind(attributes)
-        t.notOk(hasOwnAttribute('http.url'))
-        t.notOk(hasOwnAttribute('http.method'))
-        t.notOk(hasOwnAttribute('http.request.method'))
+        assert.ok(!hasOwnAttribute('http.url'))
+        assert.ok(!hasOwnAttribute('http.method'))
+        assert.ok(!hasOwnAttribute('http.request.method'))
 
         // Should have (most) datastore properties.
-        t.ok(attributes['db.instance'])
-        t.equal(attributes['db.collection'], 'my-collection')
-        t.equal(attributes['peer.hostname'], 'my-db-host')
-        t.equal(attributes['peer.address'], 'my-db-host:/path/to/db.sock')
-        t.equal(attributes['db.system'], 'TestStore') // same as intrinsics.component
-        t.equal(attributes['server.address'], 'my-db-host')
-        t.equal(attributes['server.port'], '/path/to/db.sock')
+        assert.ok(attributes['db.instance'])
+        assert.equal(attributes['db.collection'], 'my-collection')
+        assert.equal(attributes['peer.hostname'], 'my-db-host')
+        assert.equal(attributes['peer.address'], 'my-db-host:/path/to/db.sock')
+        assert.equal(attributes['db.system'], 'TestStore') // same as intrinsics.component
+        assert.equal(attributes['server.address'], 'my-db-host')
+        assert.equal(attributes['server.port'], '/path/to/db.sock')
 
         const statement = attributes['db.statement']
-        t.ok(statement)
+        assert.ok(statement)
 
         // Testing query truncation
-        t.ok(statement.endsWith('...'))
-        t.equal(Buffer.byteLength(statement, 'utf8'), 2000)
+        assert.ok(statement.endsWith('...'))
+        assert.equal(Buffer.byteLength(statement, 'utf8'), 2000)
 
-        t.end()
+        end()
       })
     })
   })
 
-  t.test('should serialize intrinsics to proper format with toJSON method', (t) => {
+  await t.test('should serialize intrinsics to proper format with toJSON method', (t, end) => {
+    const { agent } = t.nr
     helper.runInTransaction(agent, (transaction) => {
       transaction.priority = 42
       transaction.sampled = true
@@ -309,23 +308,24 @@ tap.test('fromSegment()', (t) => {
         const serializedSpan = span.toJSON()
         const [intrinsics] = serializedSpan
 
-        t.equal(intrinsics.type, 'Span')
-        t.equal(intrinsics.traceId, transaction.traceId)
-        t.equal(intrinsics.guid, segment.id)
-        t.equal(intrinsics.parentId, 'parent')
-        t.equal(intrinsics.transactionId, transaction.id)
-        t.equal(intrinsics.priority, 42)
-        t.ok(intrinsics.name)
-        t.equal(intrinsics.category, 'generic')
-        t.ok(intrinsics.timestamp)
-        t.ok(intrinsics.duration)
-
-        t.end()
+        assert.equal(intrinsics.type, 'Span')
+        assert.equal(intrinsics.traceId, transaction.traceId)
+        assert.equal(intrinsics.guid, segment.id)
+        assert.equal(intrinsics.parentId, 'parent')
+        assert.equal(intrinsics.transactionId, transaction.id)
+        assert.equal(intrinsics.priority, 42)
+        assert.ok(intrinsics.name)
+        assert.equal(intrinsics.category, 'generic')
+        assert.ok(intrinsics.timestamp)
+        assert.ok(intrinsics.duration)
+
+        end()
       }, 10)
     })
   })
 
-  t.test('should populate intrinsics from span context', (t) => {
+  await t.test('should populate intrinsics from span context', (t, end) => {
+    const { agent } = t.nr
     helper.runInTransaction(agent, (transaction) => {
       transaction.priority = 42
       transaction.sampled = true
@@ -341,15 +341,16 @@ tap.test('fromSegment()', (t) => {
         const serializedSpan = span.toJSON()
         const [intrinsics] = serializedSpan
 
-        t.equal(intrinsics['intrinsic.1'], 1)
-        t.equal(intrinsics['intrinsic.2'], 2)
+        assert.equal(intrinsics['intrinsic.1'], 1)
+        assert.equal(intrinsics['intrinsic.2'], 2)
 
-        t.end()
+        end()
       }, 10)
     })
   })
 
-  t.test('should handle truncated http spans', (t) => {
+  await t.test('should handle truncated http spans', (t, end) => {
+    const { agent } = t.nr
     helper.runInTransaction(agent, (transaction) => {
       https.get('https://example.com?foo=bar', (res) => {
         transaction.end() // prematurely end to truncate
@@ -357,32 +358,33 @@ tap.test('fromSegment()', (t) => {
         res.resume()
         res.on('end', () => {
           const segment = transaction.trace.root.children[0]
-          t.ok(segment.name.startsWith('Truncated'))
+          assert.ok(segment.name.startsWith('Truncated'))
 
           const span = SpanEvent.fromSegment(segment)
-          t.ok(span)
-          t.ok(span instanceof SpanEvent)
-          t.ok(span instanceof SpanEvent.HttpSpanEvent)
+          assert.ok(span)
+          assert.ok(span instanceof SpanEvent)
+          assert.ok(span instanceof SpanEvent.HttpSpanEvent)
 
-          t.end()
+          end()
         })
       })
     })
   })
 
-  t.test('should handle truncated datastore spans', (t) => {
+  await t.test('should handle truncated datastore spans', (t, end) => {
+    const { agent } = t.nr
     helper.runInTransaction(agent, (transaction) => {
       const segment = transaction.trace.root.add('Datastore/operation/something')
       transaction.end() // end before segment to trigger truncate
 
-      t.ok(segment.name.startsWith('Truncated'))
+      assert.ok(segment.name.startsWith('Truncated'))
 
       const span = SpanEvent.fromSegment(segment)
-      t.ok(span)
-      t.ok(span instanceof SpanEvent)
-      t.ok(span instanceof SpanEvent.DatastoreSpanEvent)
+      assert.ok(span)
+      assert.ok(span instanceof SpanEvent)
+      assert.ok(span instanceof SpanEvent.DatastoreSpanEvent)
 
-      t.end()
+      end()
     })
   })
 })
diff --git a/test/unit/spans/span-streamer.test.js b/test/unit/spans/span-streamer.test.js
index ee7c1930f6..48451f7a27 100644
--- a/test/unit/spans/span-streamer.test.js
+++ b/test/unit/spans/span-streamer.test.js
@@ -4,7 +4,8 @@
  */
 
 'use strict'
-const tap = require('tap')
+const assert = require('node:assert')
+const test = require('node:test')
 const sinon = require('sinon')
 const SpanStreamerEvent = require('../../../lib/spans/streaming-span-event.js')
 const METRIC_NAMES = require('../../../lib/metrics/names')
@@ -14,85 +15,86 @@ const fakeSpan = {
   toStreamingFormat: () => {}
 }
 
-tap.test('SpanStreamer', (t) => {
-  t.autoend()
-  let fakeConnection
-  let spanStreamer
-
-  t.beforeEach(() => {
-    fakeConnection = createFakeConnection()
-
-    spanStreamer = new SpanStreamer('fake-license-key', fakeConnection, createMetricAggregator(), 2)
+test('SpanStreamer', async (t) => {
+  t.beforeEach((ctx) => {
+    ctx.nr = {}
+    const fakeConnection = createFakeConnection()
+    ctx.nr.spanStreamer = new SpanStreamer(
+      'fake-license-key',
+      fakeConnection,
+      createMetricAggregator(),
+      2
+    )
     fakeConnection.connectSpans()
+    ctx.nr.fakeConnection = fakeConnection
   })
 
-  t.afterEach(() => {
+  t.afterEach((ctx) => {
+    const { spanStreamer } = ctx.nr
     if (spanStreamer.stream) {
       spanStreamer.stream.destroy()
     }
   })
 
-  t.test((t) => {
-    t.ok(spanStreamer, 'instantiated the object')
-    t.end()
+  await t.test((t) => {
+    const { spanStreamer } = t.nr
+    assert.ok(spanStreamer, 'instantiated the object')
   })
 
-  t.test('Should increment SEEN metric on write', (t) => {
+  await t.test('Should increment SEEN metric on write', (t) => {
+    const { spanStreamer } = t.nr
     const metricsSpy = sinon.spy(spanStreamer._metrics, 'getOrCreateMetric')
     spanStreamer.write(fakeSpan)
 
-    t.ok(metricsSpy.firstCall.calledWith(METRIC_NAMES.INFINITE_TRACING.SEEN), 'SEEN metric')
-
-    t.end()
+    assert.ok(metricsSpy.firstCall.calledWith(METRIC_NAMES.INFINITE_TRACING.SEEN), 'SEEN metric')
   })
 
-  t.test('Should add span to queue on backpressure', (t) => {
+  await t.test('Should add span to queue on backpressure', (t) => {
+    const { spanStreamer } = t.nr
     spanStreamer._writable = false
-    t.equal(spanStreamer.spans.length, 0, 'no spans queued')
+    assert.equal(spanStreamer.spans.length, 0, 'no spans queued')
     spanStreamer.write({})
 
-    t.equal(spanStreamer.spans.length, 1, 'one span queued')
-
-    t.end()
+    assert.equal(spanStreamer.spans.length, 1, 'one span queued')
   })
 
-  t.test('Should drain span queue on stream drain event', (t) => {
+  await t.test('Should drain span queue on stream drain event', (t) => {
+    const { fakeConnection, spanStreamer } = t.nr
     /* simulate backpressure */
     fakeConnection.stream.write = () => false
     spanStreamer.queue_size = 1
     const metrics = spanStreamer._metrics
 
-    t.equal(spanStreamer.spans.length, 0, 'no spans queued')
+    assert.equal(spanStreamer.spans.length, 0, 'no spans queued')
     spanStreamer.write(fakeSpan)
     spanStreamer.write(fakeSpan)
 
-    t.equal(spanStreamer.spans.length, 1, 'one span queued')
+    assert.equal(spanStreamer.spans.length, 1, 'one span queued')
 
     /* emit drain event and allow writes */
     fakeConnection.stream.emit('drain', (fakeConnection.stream.write = () => true))
 
-    t.equal(spanStreamer.spans.length, 0, 'drained spans')
-    t.equal(
+    assert.equal(spanStreamer.spans.length, 0, 'drained spans')
+    assert.equal(
       metrics.getOrCreateMetric(METRIC_NAMES.INFINITE_TRACING.DRAIN_DURATION).callCount,
       1,
       'DRAIN_DURATION metric'
     )
 
-    t.equal(
+    assert.equal(
       metrics.getOrCreateMetric(METRIC_NAMES.INFINITE_TRACING.SENT).callCount,
       2,
       'SENT metric incremented'
     )
-
-    t.end()
   })
 
-  t.test('Should properly format spans sent from the queue', (t) => {
+  await t.test('Should properly format spans sent from the queue', (t) => {
+    const { fakeConnection, spanStreamer } = t.nr
     /* simulate backpressure */
     fakeConnection.stream.write = () => false
     spanStreamer.queue_size = 1
     const metrics = spanStreamer._metrics
-    t.equal(spanStreamer.spans.length, 0, 'no spans queued')
+    assert.equal(spanStreamer.spans.length, 0, 'no spans queued')
 
     const fakeSpan1 = new SpanStreamerEvent('sandwich', {}, {})
     const fakeSpanQueued = new SpanStreamerEvent('porridge', {}, {})
@@ -100,31 +102,29 @@ tap.test('SpanStreamer', (t) => {
     spanStreamer.write(fakeSpan1)
     spanStreamer.write(fakeSpanQueued)
 
-    t.equal(spanStreamer.spans.length, 1, 'one span queued')
+    assert.equal(spanStreamer.spans.length, 1, 'one span queued')
 
     /* emit drain event, allow writes and check for span.trace_id */
     fakeConnection.stream.emit(
       'drain',
       (fakeConnection.stream.write = (span) => {
-        t.equal(span.trace_id, 'porridge', 'Should have formatted span')
+        assert.equal(span.trace_id, 'porridge', 'Should have formatted span')
 
         return true
       })
     )
 
-    t.equal(spanStreamer.spans.length, 0, 'drained spans')
-    t.equal(
+    assert.equal(spanStreamer.spans.length, 0, 'drained spans')
+    assert.equal(
       metrics.getOrCreateMetric(METRIC_NAMES.INFINITE_TRACING.DRAIN_DURATION).callCount,
       1,
       'DRAIN_DURATION metric'
     )
 
-    t.equal(
+    assert.equal(
       metrics.getOrCreateMetric(METRIC_NAMES.INFINITE_TRACING.SENT).callCount,
       2,
       'SENT metric incremented'
     )
-
-    t.end()
   })
 })
diff --git a/test/unit/spans/streaming-span-attributes.test.js b/test/unit/spans/streaming-span-attributes.test.js
index 6442d357e4..9b7588138f 100644
--- a/test/unit/spans/streaming-span-attributes.test.js
+++ b/test/unit/spans/streaming-span-attributes.test.js
@@ -4,12 +4,12 @@
  */
 
 'use strict'
-
-const tap = require('tap')
+const assert = require('node:assert')
+const test = require('node:test')
 
 const StreamingSpanAttributes = require('../../../lib/spans/streaming-span-attributes')
 
-tap.test('addAttribute() should add a valid value', (t) => {
+test('addAttribute() should add a valid value', () => {
   const testKey = 'testKey'
   const testValue = 'testValue'
   const expected = {
@@ -21,11 +21,10 @@ tap.test('addAttribute() should add a valid value', (t) => {
   const attributes = new StreamingSpanAttributes()
   attributes.addAttribute(testKey, testValue)
 
-  t.same(attributes, expected)
-  t.end()
+  assert.deepEqual(attributes, expected)
 })
 
-tap.test('addAttribute() should drp an invalid value', (t) => {
+test('addAttribute() should drp an invalid value', () => {
   const testKey = 'testKey'
   const testValue = {}
   const expected = {} // no attribute added
@@ -33,11 +32,10 @@ tap.test('addAttribute() should drp an invalid value', (t) => {
   const attributes = new StreamingSpanAttributes()
   attributes.addAttribute(testKey, testValue)
 
-  t.same(attributes, expected)
-  t.end()
+  assert.deepEqual(attributes, expected)
 })
 
-tap.test('addAttributes() should add all valid values', (t) => {
+test('addAttributes() should add all valid values', () => {
   const incomingAttributes = {
     strTest: 'value1',
     boolTest: true,
@@ -55,11 +53,10 @@ tap.test('addAttributes() should add all valid values', (t) => {
   const attributes = new StreamingSpanAttributes()
   attributes.addAttributes(incomingAttributes)
 
-  t.same(attributes, expected)
-  t.end()
+  assert.deepEqual(attributes, expected)
 })
 
-tap.test('addAttributes() should drop all invalid values', (t) => {
+test('addAttributes() should drop all invalid values', () => {
   const incomingAttributes = {
     validBool: true,
     validDouble: 99.99,
@@ -76,11 +73,10 @@ tap.test('addAttributes() should drop all invalid values', (t) => {
   const attributes = new StreamingSpanAttributes()
   attributes.addAttributes(incomingAttributes)
 
-  t.same(attributes, expected)
-  t.end()
+  assert.deepEqual(attributes, expected)
 })
 
-tap.test('constructor should add all valid values', (t) => {
+test('constructor should add all valid values', () => {
   const incomingAttributes = {
     strTest: 'value1',
     boolTest: true,
@@ -97,11 +93,10 @@ tap.test('constructor should add all valid values', (t) => {
 
   const attributes = new StreamingSpanAttributes(incomingAttributes)
 
-  t.same(attributes, expected)
-  t.end()
+  assert.deepEqual(attributes, expected)
 })
 
-tap.test('addAttributes() should drop all invalid values', (t) => {
+test('addAttributes() should drop all invalid values', () => {
   const incomingAttributes = {
     validBool: true,
     validDouble: 99.99,
@@ -117,6 +112,5 @@ tap.test('addAttributes() should drop all invalid values', (t) => {
 
   const attributes = new StreamingSpanAttributes(incomingAttributes)
 
-  t.same(attributes, expected)
-  t.end()
+  assert.deepEqual(attributes, expected)
 })
diff --git a/test/unit/spans/streaming-span-event-aggregator.test.js b/test/unit/spans/streaming-span-event-aggregator.test.js
index 70780331bc..4af3c73501 100644
--- a/test/unit/spans/streaming-span-event-aggregator.test.js
+++ b/test/unit/spans/streaming-span-event-aggregator.test.js
@@ -4,8 +4,8 @@
  */
 
 'use strict'
-
-const tap = require('tap')
+const assert = require('node:assert')
+const test = require('node:test')
 const sinon = require('sinon')
 
 const StreamingSpanEventAggregator = require('../../../lib/spans/streaming-span-event-aggregator')
@@ -15,7 +15,7 @@ const agent = {
   harvester: { add: sinon.stub() }
 }
 
-tap.test('Should only attempt to connect on first start() call', (t) => {
+test('Should only attempt to connect on first start() call', () => {
   let connectCount = 0
 
   const opts = {
@@ -29,22 +29,20 @@ tap.test('Should only attempt to connect on first start() call', (t) => {
   const streamingSpanAggregator = new StreamingSpanEventAggregator(opts, agent)
 
   streamingSpanAggregator.start()
-  t.equal(connectCount, 1)
+  assert.equal(connectCount, 1)
 
   streamingSpanAggregator.start()
-  t.equal(connectCount, 1)
-
-  t.end()
+  assert.equal(connectCount, 1)
 })
 
-tap.test('Should only attempt to disconnect on first stop() call', (t) => {
-  let disonnectCount = 0
+test('Should only attempt to disconnect on first stop() call', () => {
+  let disconnectCount = 0
 
   const opts = {
     span_streamer: {
       connect: () => {},
       disconnect: () => {
-        disonnectCount++
+        disconnectCount++
       }
     }
   }
@@ -53,15 +51,13 @@ tap.test('Should only attempt to disconnect on first stop() call', (t) => {
   streamingSpanAggregator.start()
 
   streamingSpanAggregator.stop()
-  t.equal(disonnectCount, 1)
+  assert.equal(disconnectCount, 1)
 
   streamingSpanAggregator.stop()
-  t.equal(disonnectCount, 1)
-
-  t.end()
+  assert.equal(disconnectCount, 1)
 })
 
-tap.test('Should attempt to connect on start() after stop() call', (t) => {
+test('Should attempt to connect on start() after stop() call', () => {
   let connectCount = 0
 
   const opts = {
@@ -79,7 +75,5 @@ tap.test('Should attempt to connect on start() after stop() call', (t) => {
   streamingSpanAggregator.stop()
 
   streamingSpanAggregator.start()
-  t.equal(connectCount, 2)
-
-  t.end()
+  assert.equal(connectCount, 2)
 })
diff --git a/test/unit/spans/streaming-span-event.test.js b/test/unit/spans/streaming-span-event.test.js
index 80d82171f7..4c63ce144c 100644
--- a/test/unit/spans/streaming-span-event.test.js
+++ b/test/unit/spans/streaming-span-event.test.js
@@ -4,8 +4,8 @@
  */
 
 'use strict'
-
-const tap = require('tap')
+const assert = require('node:assert')
+const test = require('node:test')
 const DatastoreShim = require('../../../lib/shim/datastore-shim')
 const helper = require('../../lib/agent_helper')
 const https = require('https')
@@ -26,39 +26,35 @@ const BOOL_TYPE = 'bool_value'
 const INT_TYPE = 'int_value'
 const DOUBLE_TYPE = 'double_value'
 
-tap.test('#constructor() should construct an empty span event', (t) => {
+test('#constructor() should construct an empty span event', () => {
   const attrs = {}
   const span = new StreamingSpanEvent(attrs)
 
-  t.ok(span)
-  t.ok(span instanceof StreamingSpanEvent)
-  t.same(span._agentAttributes, attrs)
-
-  t.ok(span._intrinsicAttributes)
-  t.same(span._intrinsicAttributes.type, { [STRING_TYPE]: 'Span' })
-  t.same(span._intrinsicAttributes.category, { [STRING_TYPE]: CATEGORIES.GENERIC })
+  assert.ok(span)
+  assert.ok(span instanceof StreamingSpanEvent)
+  assert.deepEqual(span._agentAttributes, attrs)
 
-  t.end()
+  assert.ok(span._intrinsicAttributes)
+  assert.deepEqual(span._intrinsicAttributes.type, { [STRING_TYPE]: 'Span' })
+  assert.deepEqual(span._intrinsicAttributes.category, { [STRING_TYPE]: CATEGORIES.GENERIC })
 })
 
-tap.test('fromSegment()', (t) => {
-  t.autoend()
-
-  let agent = null
-
-  t.beforeEach(() => {
-    agent = helper.instrumentMockedAgent({
+test('fromSegment()', async (t) => {
+  t.beforeEach((ctx) => {
+    ctx.nr = {}
+    ctx.nr.agent = helper.instrumentMockedAgent({
       distributed_tracing: {
         enabled: true
       }
     })
   })
 
-  t.afterEach(() => {
-    helper.unloadAgent(agent)
+  t.afterEach((ctx) => {
+    helper.unloadAgent(ctx.nr.agent)
   })
 
-  t.test('should create a generic span with a random segment', (t) => {
+  await t.test('should create a generic span with a random segment', (t, end) => {
+    const { agent } = t.nr
     helper.runInTransaction(agent, (transaction) => {
       transaction.sampled = true
       transaction.priority = 42
@@ -73,59 +69,60 @@ tap.test('fromSegment()', (t) => {
         const span = StreamingSpanEvent.fromSegment(segment, 'parent')
 
         // Should have all the normal properties.
-        t.ok(span)
-        t.ok(span instanceof StreamingSpanEvent)
+        assert.ok(span)
+        assert.ok(span instanceof StreamingSpanEvent)
 
-        t.ok(span._intrinsicAttributes)
-        t.same(span._intrinsicAttributes.type, { [STRING_TYPE]: 'Span' })
-        t.same(span._intrinsicAttributes.category, { [STRING_TYPE]: CATEGORIES.GENERIC })
+        assert.ok(span._intrinsicAttributes)
+        assert.deepEqual(span._intrinsicAttributes.type, { [STRING_TYPE]: 'Span' })
+        assert.deepEqual(span._intrinsicAttributes.category, { [STRING_TYPE]: CATEGORIES.GENERIC })
 
-        t.same(span._intrinsicAttributes.traceId, { [STRING_TYPE]: transaction.traceId })
-        t.same(span._intrinsicAttributes.guid, { [STRING_TYPE]: segment.id })
-        t.same(span._intrinsicAttributes.parentId, { [STRING_TYPE]: 'parent' })
-        t.same(span._intrinsicAttributes.transactionId, { [STRING_TYPE]: transaction.id })
-        t.same(span._intrinsicAttributes.sampled, { [BOOL_TYPE]: true })
-        t.same(span._intrinsicAttributes.priority, { [INT_TYPE]: 42 })
-        t.same(span._intrinsicAttributes.name, { [STRING_TYPE]: 'timers.setTimeout' })
-        t.same(span._intrinsicAttributes.timestamp, { [INT_TYPE]: segment.timer.start })
+        assert.deepEqual(span._intrinsicAttributes.traceId, { [STRING_TYPE]: transaction.traceId })
+        assert.deepEqual(span._intrinsicAttributes.guid, { [STRING_TYPE]: segment.id })
+        assert.deepEqual(span._intrinsicAttributes.parentId, { [STRING_TYPE]: 'parent' })
+        assert.deepEqual(span._intrinsicAttributes.transactionId, { [STRING_TYPE]: transaction.id })
+        assert.deepEqual(span._intrinsicAttributes.sampled, { [BOOL_TYPE]: true })
+        assert.deepEqual(span._intrinsicAttributes.priority, { [INT_TYPE]: 42 })
+        assert.deepEqual(span._intrinsicAttributes.name, { [STRING_TYPE]: 'timers.setTimeout' })
+        assert.deepEqual(span._intrinsicAttributes.timestamp, { [INT_TYPE]: segment.timer.start })
 
-        t.ok(span._intrinsicAttributes.duration)
-        t.ok(span._intrinsicAttributes.duration[DOUBLE_TYPE])
+        assert.ok(span._intrinsicAttributes.duration)
+        assert.ok(span._intrinsicAttributes.duration[DOUBLE_TYPE])
 
         // Generic should not have 'span.kind' or 'component'
         const hasIntrinsic = Object.hasOwnProperty.bind(span._intrinsicAttributes)
-        t.notOk(hasIntrinsic('span.kind'))
-        t.notOk(hasIntrinsic('component'))
+        assert.ok(!hasIntrinsic('span.kind'))
+        assert.ok(!hasIntrinsic('component'))
 
         const customAttributes = span._customAttributes
-        t.ok(customAttributes)
-        t.same(customAttributes['Span Lee'], { [STRING_TYPE]: 'no prize' })
+        assert.ok(customAttributes)
+        assert.deepEqual(customAttributes['Span Lee'], { [STRING_TYPE]: 'no prize' })
 
         const agentAttributes = span._agentAttributes
-        t.ok(agentAttributes)
+        assert.ok(agentAttributes)
 
-        t.same(agentAttributes['server.address'], { [STRING_TYPE]: 'my-host' })
-        t.same(agentAttributes['server.port'], { [INT_TYPE]: 22 })
+        assert.deepEqual(agentAttributes['server.address'], { [STRING_TYPE]: 'my-host' })
+        assert.deepEqual(agentAttributes['server.port'], { [INT_TYPE]: 22 })
 
         // Should have no http properties.
         const hasOwnAttribute = Object.hasOwnProperty.bind(agentAttributes)
-        t.notOk(hasOwnAttribute('externalLibrary'))
-        t.notOk(hasOwnAttribute('externalUri'))
-        t.notOk(hasOwnAttribute('externalProcedure'))
+        assert.ok(!hasOwnAttribute('externalLibrary'))
+        assert.ok(!hasOwnAttribute('externalUri'))
+        assert.ok(!hasOwnAttribute('externalProcedure'))
 
         // Should have no datastore properties.
-        t.notOk(hasOwnAttribute('db.statement'))
-        t.notOk(hasOwnAttribute('db.instance'))
-        t.notOk(hasOwnAttribute('db.system'))
-        t.notOk(hasOwnAttribute('peer.hostname'))
-        t.notOk(hasOwnAttribute('peer.address'))
+        assert.ok(!hasOwnAttribute('db.statement'))
+        assert.ok(!hasOwnAttribute('db.instance'))
+        assert.ok(!hasOwnAttribute('db.system'))
+        assert.ok(!hasOwnAttribute('peer.hostname'))
+        assert.ok(!hasOwnAttribute('peer.address'))
 
-        t.end()
+        end()
       }, 50)
     })
   })
 
-  t.test('should create an http span with a external segment', (t) => {
+  await t.test('should create an http span with a external segment', (t, end) => {
+    const { agent } = t.nr
     helper.runInTransaction(agent, (transaction) => {
       transaction.sampled = true
       transaction.priority = 42
@@ -137,63 +134,70 @@ tap.test('fromSegment()', (t) => {
           const span = StreamingSpanEvent.fromSegment(segment, 'parent')
 
           // Should have all the normal properties.
-          t.ok(span)
-          t.ok(span instanceof StreamingSpanEvent)
+          assert.ok(span)
+          assert.ok(span instanceof StreamingSpanEvent)
 
-          t.ok(span._intrinsicAttributes)
-          t.same(span._intrinsicAttributes.type, { [STRING_TYPE]: 'Span' })
-          t.same(span._intrinsicAttributes.category, { [STRING_TYPE]: CATEGORIES.HTTP })
+          assert.ok(span._intrinsicAttributes)
+          assert.deepEqual(span._intrinsicAttributes.type, { [STRING_TYPE]: 'Span' })
+          assert.deepEqual(span._intrinsicAttributes.category, { [STRING_TYPE]: CATEGORIES.HTTP })
 
-          t.same(span._intrinsicAttributes.traceId, { [STRING_TYPE]: transaction.traceId })
-          t.same(span._intrinsicAttributes.guid, { [STRING_TYPE]: segment.id })
-          t.same(span._intrinsicAttributes.parentId, { [STRING_TYPE]: 'parent' })
-          t.same(span._intrinsicAttributes.transactionId, { [STRING_TYPE]: transaction.id })
-          t.same(span._intrinsicAttributes.sampled, { [BOOL_TYPE]: true })
-          t.same(span._intrinsicAttributes.priority, { [INT_TYPE]: 42 })
+          assert.deepEqual(span._intrinsicAttributes.traceId, {
+            [STRING_TYPE]: transaction.traceId
+          })
+          assert.deepEqual(span._intrinsicAttributes.guid, { [STRING_TYPE]: segment.id })
+          assert.deepEqual(span._intrinsicAttributes.parentId, { [STRING_TYPE]: 'parent' })
+          assert.deepEqual(span._intrinsicAttributes.transactionId, {
+            [STRING_TYPE]: transaction.id
+          })
+          assert.deepEqual(span._intrinsicAttributes.sampled, { [BOOL_TYPE]: true })
+          assert.deepEqual(span._intrinsicAttributes.priority, { [INT_TYPE]: 42 })
 
-          t.same(span._intrinsicAttributes.name, { [STRING_TYPE]: 'External/example.com/' })
-          t.same(span._intrinsicAttributes.timestamp, { [INT_TYPE]: segment.timer.start })
+          assert.deepEqual(span._intrinsicAttributes.name, {
+            [STRING_TYPE]: 'External/example.com/'
+          })
+          assert.deepEqual(span._intrinsicAttributes.timestamp, { [INT_TYPE]: segment.timer.start })
 
-          t.ok(span._intrinsicAttributes.duration)
-          t.ok(span._intrinsicAttributes.duration[DOUBLE_TYPE])
+          assert.ok(span._intrinsicAttributes.duration)
+          assert.ok(span._intrinsicAttributes.duration[DOUBLE_TYPE])
 
           // Should have type-specific intrinsics
-          t.same(span._intrinsicAttributes.component, { [STRING_TYPE]: 'http' })
-          t.same(span._intrinsicAttributes['span.kind'], { [STRING_TYPE]: 'client' })
+          assert.deepEqual(span._intrinsicAttributes.component, { [STRING_TYPE]: 'http' })
+          assert.deepEqual(span._intrinsicAttributes['span.kind'], { [STRING_TYPE]: 'client' })
 
           const agentAttributes = span._agentAttributes
-          t.ok(agentAttributes)
+          assert.ok(agentAttributes)
 
           // Should have (most) http properties.
-          t.same(agentAttributes['request.parameters.foo'], { [STRING_TYPE]: 'bar' })
-          t.same(agentAttributes['http.url'], { [STRING_TYPE]: 'https://example.com/' })
-          t.same(agentAttributes['server.address'], { [STRING_TYPE]: 'example.com' })
-          t.same(agentAttributes['server.port'], { [INT_TYPE]: 443 })
-          t.ok(agentAttributes['http.method'])
-          t.ok(agentAttributes['http.request.method'])
-          t.same(agentAttributes['http.statusCode'], { [INT_TYPE]: 200 })
-          t.same(agentAttributes['http.statusText'], { [STRING_TYPE]: 'OK' })
+          assert.deepEqual(agentAttributes['request.parameters.foo'], { [STRING_TYPE]: 'bar' })
+          assert.deepEqual(agentAttributes['http.url'], { [STRING_TYPE]: 'https://example.com/' })
+          assert.deepEqual(agentAttributes['server.address'], { [STRING_TYPE]: 'example.com' })
+          assert.deepEqual(agentAttributes['server.port'], { [INT_TYPE]: 443 })
+          assert.ok(agentAttributes['http.method'])
+          assert.ok(agentAttributes['http.request.method'])
+          assert.deepEqual(agentAttributes['http.statusCode'], { [INT_TYPE]: 200 })
+          assert.deepEqual(agentAttributes['http.statusText'], { [STRING_TYPE]: 'OK' })
 
           const hasOwnAttribute = Object.hasOwnProperty.bind(agentAttributes)
 
           // should remove mapped attributes
           ;['library', 'url', 'hostname', 'port', 'procedure'].forEach((attr) => {
-            t.notOk(hasOwnAttribute(attr))
+            assert.ok(!hasOwnAttribute(attr))
           })
 
           // Should have no datastore properties.
           ;['db.statement', 'db.instance', 'db.system', 'peer.hostname', 'peer.address'].forEach(
             (attr) => {
-              t.notOk(hasOwnAttribute(attr))
+              assert.ok(!hasOwnAttribute(attr))
             }
           )
-          t.end()
+          end()
         })
       })
     })
   })
 
-  t.test('should create a datastore span with a datastore segment', (t) => {
+  await t.test('should create a datastore span with a datastore segment', (t, end) => {
+    const { agent } = t.nr
     agent.config.transaction_tracer.record_sql = 'raw'
 
     const shim = new DatastoreShim(agent, 'test-data-store')
@@ -237,40 +241,42 @@ tap.test('fromSegment()', (t) => {
         const span = StreamingSpanEvent.fromSegment(segment, 'parent')
 
         // Should have all the normal properties.
-        t.ok(span)
-        t.ok(span instanceof StreamingSpanEvent)
+        assert.ok(span)
+        assert.ok(span instanceof StreamingSpanEvent)
 
-        t.ok(span._intrinsicAttributes)
-        t.same(span._intrinsicAttributes.type, { [STRING_TYPE]: 'Span' })
-        t.same(span._intrinsicAttributes.category, { [STRING_TYPE]: CATEGORIES.DATASTORE })
+        assert.ok(span._intrinsicAttributes)
+        assert.deepEqual(span._intrinsicAttributes.type, { [STRING_TYPE]: 'Span' })
+        assert.deepEqual(span._intrinsicAttributes.category, {
+          [STRING_TYPE]: CATEGORIES.DATASTORE
+        })
 
-        t.same(span._intrinsicAttributes.traceId, { [STRING_TYPE]: transaction.traceId })
-        t.same(span._intrinsicAttributes.guid, { [STRING_TYPE]: segment.id })
-        t.same(span._intrinsicAttributes.parentId, { [STRING_TYPE]: 'parent' })
-        t.same(span._intrinsicAttributes.transactionId, { [STRING_TYPE]: transaction.id })
-        t.same(span._intrinsicAttributes.sampled, { [BOOL_TYPE]: true })
-        t.same(span._intrinsicAttributes.priority, { [INT_TYPE]: 42 })
+        assert.deepEqual(span._intrinsicAttributes.traceId, { [STRING_TYPE]: transaction.traceId })
+        assert.deepEqual(span._intrinsicAttributes.guid, { [STRING_TYPE]: segment.id })
+        assert.deepEqual(span._intrinsicAttributes.parentId, { [STRING_TYPE]: 'parent' })
+        assert.deepEqual(span._intrinsicAttributes.transactionId, { [STRING_TYPE]: transaction.id })
+        assert.deepEqual(span._intrinsicAttributes.sampled, { [BOOL_TYPE]: true })
+        assert.deepEqual(span._intrinsicAttributes.priority, { [INT_TYPE]: 42 })
 
-        t.same(span._intrinsicAttributes.name, {
+        assert.deepEqual(span._intrinsicAttributes.name, {
           [STRING_TYPE]: 'Datastore/statement/TestStore/test/test'
         })
 
-        t.same(span._intrinsicAttributes.timestamp, { [INT_TYPE]: segment.timer.start })
+        assert.deepEqual(span._intrinsicAttributes.timestamp, { [INT_TYPE]: segment.timer.start })
 
-        t.ok(span._intrinsicAttributes.duration)
-        t.ok(span._intrinsicAttributes.duration[DOUBLE_TYPE])
+        assert.ok(span._intrinsicAttributes.duration)
+        assert.ok(span._intrinsicAttributes.duration[DOUBLE_TYPE])
 
         // Should have (most) type-specific intrinsics
-        t.same(span._intrinsicAttributes.component, { [STRING_TYPE]: 'TestStore' })
-        t.same(span._intrinsicAttributes['span.kind'], { [STRING_TYPE]: 'client' })
+        assert.deepEqual(span._intrinsicAttributes.component, { [STRING_TYPE]: 'TestStore' })
+        assert.deepEqual(span._intrinsicAttributes['span.kind'], { [STRING_TYPE]: 'client' })
 
         const agentAttributes = span._agentAttributes
-        t.ok(agentAttributes)
+        assert.ok(agentAttributes)
 
         // Should have not http properties.
         const hasOwnAttribute = Object.hasOwnProperty.bind(agentAttributes)
         ;['http.url', 'http.method', 'http.request.method'].forEach((attr) => {
-          t.notOk(hasOwnAttribute(attr))
+          assert.ok(!hasOwnAttribute(attr))
         })
 
         // Should removed map attributes
@@ -283,32 +289,35 @@ tap.test('fromSegment()', (t) => {
           'host',
           'port_path_or_id'
         ].forEach((attr) => {
-          t.notOk(hasOwnAttribute(attr))
+          assert.ok(!hasOwnAttribute(attr))
         })
         // Should have (most) datastore properties.
-        t.ok(agentAttributes['db.instance'])
-        t.same(agentAttributes['db.collection'], { [STRING_TYPE]: 'my-collection' })
-        t.same(agentAttributes['peer.hostname'], { [STRING_TYPE]: 'my-db-host' })
-        t.same(agentAttributes['peer.address'], { [STRING_TYPE]: 'my-db-host:/path/to/db.sock' })
-        t.same(agentAttributes['db.system'], { [STRING_TYPE]: 'TestStore' }) // same as intrinsics.component
-        t.same(agentAttributes['server.address'], { [STRING_TYPE]: 'my-db-host' })
-        t.same(agentAttributes['server.port'], { [STRING_TYPE]: '/path/to/db.sock' })
+        assert.ok(agentAttributes['db.instance'])
+        assert.deepEqual(agentAttributes['db.collection'], { [STRING_TYPE]: 'my-collection' })
+        assert.deepEqual(agentAttributes['peer.hostname'], { [STRING_TYPE]: 'my-db-host' })
+        assert.deepEqual(agentAttributes['peer.address'], {
+          [STRING_TYPE]: 'my-db-host:/path/to/db.sock'
+        })
+        assert.deepEqual(agentAttributes['db.system'], { [STRING_TYPE]: 'TestStore' }) // same as intrinsics.component
+        assert.deepEqual(agentAttributes['server.address'], { [STRING_TYPE]: 'my-db-host' })
+        assert.deepEqual(agentAttributes['server.port'], { [STRING_TYPE]: '/path/to/db.sock' })
 
         const statement = agentAttributes['db.statement']
-        t.ok(statement)
+        assert.ok(statement)
 
         // Testing query truncation
         const actualValue = statement[STRING_TYPE]
-        t.ok(actualValue)
-        t.ok(actualValue.endsWith('...'))
-        t.equal(Buffer.byteLength(actualValue, 'utf8'), 2000)
+        assert.ok(actualValue)
+        assert.ok(actualValue.endsWith('...'))
+        assert.equal(Buffer.byteLength(actualValue, 'utf8'), 2000)
 
-        t.end()
+        end()
       })
     })
   })
 
-  t.test('should serialize to proper format with toStreamingFormat()', (t) => {
+  await t.test('should serialize to proper format with toStreamingFormat()', (t, end) => {
+    const { agent } = t.nr
     helper.runInTransaction(agent, (transaction) => {
       transaction.priority = 42
       transaction.sampled = true
@@ -330,22 +339,23 @@ tap.test('fromSegment()', (t) => {
           agent_attributes: agentAttributes
         } = serializedSpan
 
-        t.equal(traceId, transaction.traceId)
+        assert.equal(traceId, transaction.traceId)
 
         // Spot check a few known attributes
-        t.same(intrinsics.type, { [STRING_TYPE]: 'Span' })
-        t.same(intrinsics.traceId, { [STRING_TYPE]: transaction.traceId })
+        assert.deepEqual(intrinsics.type, { [STRING_TYPE]: 'Span' })
+        assert.deepEqual(intrinsics.traceId, { [STRING_TYPE]: transaction.traceId })
 
-        t.same(userAttributes.customKey, { [STRING_TYPE]: 'customValue' })
+        assert.deepEqual(userAttributes.customKey, { [STRING_TYPE]: 'customValue' })
 
-        t.same(agentAttributes.anAgentAttribute, { [BOOL_TYPE]: true })
+        assert.deepEqual(agentAttributes.anAgentAttribute, { [BOOL_TYPE]: true })
 
-        t.end()
+        end()
       }, 10)
     })
   })
 
-  t.test('should populate intrinsics from span context', (t) => {
+  await t.test('should populate intrinsics from span context', (t, end) => {
+    const { agent } = t.nr
     helper.runInTransaction(agent, (transaction) => {
       transaction.priority = 42
       transaction.sampled = true
@@ -361,15 +371,16 @@ tap.test('fromSegment()', (t) => {
         const serializedSpan = span.toStreamingFormat()
         const { intrinsics } = serializedSpan
 
-        t.same(intrinsics['intrinsic.1'], { [INT_TYPE]: 1 })
-        t.same(intrinsics['intrinsic.2'], { [INT_TYPE]: 2 })
+        assert.deepEqual(intrinsics['intrinsic.1'], { [INT_TYPE]: 1 })
+        assert.deepEqual(intrinsics['intrinsic.2'], { [INT_TYPE]: 2 })
 
-        t.end()
+        end()
       }, 10)
     })
   })
 
-  t.test('should handle truncated http spans', (t) => {
+  await t.test('should handle truncated http spans', (t, end) => {
+    const { agent } = t.nr
     helper.runInTransaction(agent, (transaction) => {
       https.get('https://example.com?foo=bar', (res) => {
         transaction.end() // prematurely end to truncate
@@ -377,37 +388,38 @@ tap.test('fromSegment()', (t) => {
         res.resume()
         res.on('end', () => {
           const segment = transaction.trace.root.children[0]
-          t.ok(segment.name.startsWith('Truncated'))
+          assert.ok(segment.name.startsWith('Truncated'))
 
           const span = StreamingSpanEvent.fromSegment(segment)
-          t.ok(span)
-          t.ok(span instanceof StreamingSpanEvent)
+          assert.ok(span)
+          assert.ok(span instanceof StreamingSpanEvent)
 
-          t.ok(span._intrinsicAttributes)
-          t.same(span._intrinsicAttributes.category, { [STRING_TYPE]: CATEGORIES.HTTP })
-          t.same(span._intrinsicAttributes['span.kind'], { [STRING_TYPE]: 'client' })
+          assert.ok(span._intrinsicAttributes)
+          assert.deepEqual(span._intrinsicAttributes.category, { [STRING_TYPE]: CATEGORIES.HTTP })
+          assert.deepEqual(span._intrinsicAttributes['span.kind'], { [STRING_TYPE]: 'client' })
 
-          t.end()
+          end()
         })
       })
     })
   })
 
-  t.test('should handle truncated datastore spans', (t) => {
+  await t.test('should handle truncated datastore spans', (t, end) => {
+    const { agent } = t.nr
     helper.runInTransaction(agent, (transaction) => {
       const segment = transaction.trace.root.add('Datastore/operation/something')
       transaction.end() // end before segment to trigger truncate
 
-      t.ok(segment.name.startsWith('Truncated'))
+      assert.ok(segment.name.startsWith('Truncated'))
 
       const span = StreamingSpanEvent.fromSegment(segment)
-      t.ok(span)
-      t.ok(span instanceof StreamingSpanEvent)
+      assert.ok(span)
+      assert.ok(span instanceof StreamingSpanEvent)
 
-      t.same(span._intrinsicAttributes.category, { [STRING_TYPE]: CATEGORIES.DATASTORE })
-      t.same(span._intrinsicAttributes['span.kind'], { [STRING_TYPE]: 'client' })
+      assert.deepEqual(span._intrinsicAttributes.category, { [STRING_TYPE]: CATEGORIES.DATASTORE })
+      assert.deepEqual(span._intrinsicAttributes['span.kind'], { [STRING_TYPE]: 'client' })
 
-      t.end()
+      end()
     })
   })
 })