Skip to content

Commit

Permalink
chore: Updated agent integration tests to node:test (#2782)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsumners-nr authored Nov 22, 2024
1 parent 36bc0e7 commit d556512
Show file tree
Hide file tree
Showing 8 changed files with 486 additions and 460 deletions.
4 changes: 3 additions & 1 deletion .borp.int.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
files:
- 'test/integration/**/*.tap.js'
- 'test/integration/**/*.test.js'
# We need to ignore any `*.test.js` files within nested `node_modules`
# directories. We only want to target the tests we have written ourselves.
- '!test/integration/**/node_modules/**/*'

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

'use strict'

const test = require('tap').test
const test = require('node:test')
const assert = require('node:assert')

const metricPrefix = require('../../../lib/metrics/names').SUPPORTABILITY.PREFIX

test('Multiple require("newrelic")', function (t) {
test('Multiple require("newrelic")', () => {
process.env.NEW_RELIC_ENABLED = true
process.env.NEW_RELIC_APP_NAME = 'agent test'

Expand All @@ -19,8 +21,7 @@ test('Multiple require("newrelic")', function (t) {

const second = require(path)

t.equal(first, second)
assert.equal(first, second)
const doubleLoadMetric = second.agent.metrics.getOrCreateMetric(`${metricPrefix}Agent/DoubleLoad`)
t.equal(doubleLoadMetric.callCount, 1, 'should have tried to double-load the agent once')
t.end()
assert.equal(doubleLoadMetric.callCount, 1, 'should have tried to double-load the agent once')
})
Loading

0 comments on commit d556512

Please sign in to comment.