diff --git a/test/smoke/api/connection.tap.js b/test/smoke/api/connection.test.js similarity index 61% rename from test/smoke/api/connection.tap.js rename to test/smoke/api/connection.test.js index 53b2089c9a..c1251f68ed 100644 --- a/test/smoke/api/connection.tap.js +++ b/test/smoke/api/connection.test.js @@ -4,14 +4,14 @@ */ 'use strict' - -const tap = require('tap') +const test = require('node:test') +const assert = require('node:assert') const configurator = require('../../../lib/config') const Agent = require('../../../lib/agent') const { getTestSecret } = require('../../helpers/secrets') const license = getTestSecret('TEST_LICENSE') -tap.test('Collector API should connect to staging-collector.newrelic.com', (t) => { +test('Collector API should connect to staging-collector.newrelic.com', (t, end) => { const config = configurator.initialize({ app_name: 'node.js Tests', license_key: license, @@ -32,20 +32,20 @@ tap.test('Collector API should connect to staging-collector.newrelic.com', (t) = const api = agent.collector api.connect(function (error, response) { - t.error(error, 'connected without error') + assert.ok(!error, 'connected without error') const returned = response && response.payload - t.ok(returned, 'got boot configuration') - t.ok(returned.agent_run_id, 'got run ID') - t.ok(agent.config.run_id, 'run ID set in configuration') + assert.ok(returned, 'got boot configuration') + assert.ok(returned.agent_run_id, 'got run ID') + assert.ok(agent.config.run_id, 'run ID set in configuration') api.shutdown(function (error) { - t.error(error, 'should have shut down without issue') - t.notOk(agent.config.run_id, 'run ID should have been cleared by shutdown') + assert.ok(!error, 'should have shut down without issue') + assert.ok(!agent.config.run_id, 'run ID should have been cleared by shutdown') agent.stop((err) => { - t.error(err, 'should not fail to stop') - t.end() + assert.ok(!err, 'should not fail to stop') + end() }) }) }) diff --git a/test/smoke/api/error-data.tap.js b/test/smoke/api/error-data.test.js similarity index 77% rename from test/smoke/api/error-data.tap.js rename to test/smoke/api/error-data.test.js index 79579414cf..79d3175726 100644 --- a/test/smoke/api/error-data.tap.js +++ b/test/smoke/api/error-data.test.js @@ -4,14 +4,14 @@ */ 'use strict' - -const test = require('tap').test +const test = require('node:test') +const assert = require('node:assert') const configurator = require('../../../lib/config') const Agent = require('../../../lib/agent') const { getTestSecret } = require('../../helpers/secrets') const license = getTestSecret('TEST_LICENSE') -test('Collector API should send errors to staging-collector.newrelic.com', (t) => { +test('Collector API should send errors to staging-collector.newrelic.com', (t, end) => { const config = configurator.initialize({ app_name: 'node.js Tests', license_key: license, @@ -32,7 +32,7 @@ test('Collector API should send errors to staging-collector.newrelic.com', (t) = const api = agent.collector api.connect(function (error) { - t.error(error, 'connected without error') + assert.ok(!error, 'connected without error') let transaction const proxy = agent.tracer.transactionProxy(function () { @@ -40,18 +40,18 @@ test('Collector API should send errors to staging-collector.newrelic.com', (t) = transaction.finalizeNameFromUri('/nonexistent', 501) }) proxy() - t.ok(transaction, 'got a transaction') + assert.ok(transaction, 'got a transaction') agent.errors.add(transaction, new Error('test error')) const payload = [agent.config.run_id, agent.errors.traceAggregator.errors] api.send('error_data', payload, function (error, command) { - t.error(error, 'sent errors without error') - t.notOk(command.returned, 'return value is null') + assert.ok(!error, 'sent errors without error') + assert.ok(!command.returned, 'return value is null') agent.stop((err) => { - t.error(err, 'should not fail to stop') - t.end() + assert.ok(!err, 'should not fail to stop') + end() }) }) }) diff --git a/test/smoke/api/metric-data.tap.js b/test/smoke/api/metric-data.test.js similarity index 76% rename from test/smoke/api/metric-data.tap.js rename to test/smoke/api/metric-data.test.js index 9eb8a45263..3d966110da 100644 --- a/test/smoke/api/metric-data.tap.js +++ b/test/smoke/api/metric-data.test.js @@ -4,15 +4,15 @@ */ 'use strict' - -const test = require('tap').test +const test = require('node:test') +const assert = require('node:assert') const configurator = require('../../../lib/config') const Agent = require('../../../lib/agent') const CollectorAPI = require('../../../lib/collector/api') const { getTestSecret } = require('../../helpers/secrets') const license = getTestSecret('TEST_LICENSE') -test('Collector API should send metrics to staging-collector.newrelic.com', (t) => { +test('Collector API should send metrics to staging-collector.newrelic.com', (t, end) => { const config = configurator.initialize({ app_name: 'node.js Tests', license_key: license, @@ -34,24 +34,23 @@ test('Collector API should send metrics to staging-collector.newrelic.com', (t) const api = new CollectorAPI(agent) api.connect(function (error) { - t.notOk(error, 'connected without error') + assert.ok(!error, 'connected without error') agent.metrics.measureMilliseconds('TEST/discard', null, 101) const metrics = agent.metrics._metrics const metricJson = metrics.toJSON() - t.ok(metricJson.length >= 2, 'Should have at least two metrics.') + assert.ok(metricJson.length >= 2, 'Should have at least two metrics.') const payload = [agent.config.run_id, metrics.started / 1000, Date.now() / 1000, metrics] api.send('metric_data', payload, function (error, command) { - t.notOk(error, 'sent metrics without error') - t.ok(command, 'got a response') - - t.same(command, { retainData: false }) + assert.ok(!error, 'sent metrics without error') + assert.ok(command, 'got a response') - t.end() + assert.deepEqual(command, { retainData: false }) + end() }) }) }) diff --git a/test/smoke/api/transaction-sample-data.tap.js b/test/smoke/api/transaction-sample-data.test.js similarity index 69% rename from test/smoke/api/transaction-sample-data.tap.js rename to test/smoke/api/transaction-sample-data.test.js index 9ef88cad53..65fda5c2e7 100644 --- a/test/smoke/api/transaction-sample-data.tap.js +++ b/test/smoke/api/transaction-sample-data.test.js @@ -4,14 +4,14 @@ */ 'use strict' - -const tap = require('tap') +const test = require('node:test') +const assert = require('node:assert') const configurator = require('../../../lib/config') const Agent = require('../../../lib/agent') const { getTestSecret } = require('../../helpers/secrets') const license = getTestSecret('TEST_LICENSE') -tap.test('Collector API should send transaction traces to staging-collector.newrelic.com', (t) => { +test('Collector API should send transaction traces to staging-collector.newrelic.com', (t, end) => { const config = configurator.initialize({ app_name: 'node.js Tests', license_key: license, @@ -32,7 +32,7 @@ tap.test('Collector API should send transaction traces to staging-collector.newr const api = agent.collector api.connect(function (error) { - t.error(error, 'connected without error') + assert.ok(!error, 'connected without error') let transaction const proxy = agent.tracer.transactionProxy(function () { @@ -44,21 +44,21 @@ tap.test('Collector API should send transaction traces to staging-collector.newr // ensure it's slow enough to get traced transaction.trace.setDurationInMillis(5001) transaction.end() - t.ok(agent.traces.trace, 'have a slow trace to send') + assert.ok(agent.traces.trace, 'have a slow trace to send') agent.traces.trace.generateJSON((err, encoded) => { - t.error(err, 'should encode trace without error') - t.ok(encoded, 'have the encoded trace') + assert.ok(!err, 'should encode trace without error') + assert.ok(encoded, 'have the encoded trace') const payload = [agent.config.run_id, [encoded]] api.send('transaction_sample_data', payload, function (error, command) { - t.error(error, 'sent transaction trace without error') - t.notOk(command.returned, 'return value is null') + assert.ok(!error, 'sent transaction trace without error') + assert.ok(!command.returned, 'return value is null') agent.stop((err) => { - t.error(err, 'should not fail to stop') - t.end() + assert.ok(!err, 'should not fail to stop') + end() }) }) })