Skip to content

Commit b808e00

Browse files
authored
test: Fixed handling require esm for >20.19.0+ (#3002)
1 parent cdfa042 commit b808e00

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/integration/config/config-esm.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const exec = util.promisify(require('child_process').exec)
2121
test('should gracefully handle ESM imports', async (t) => {
2222
await t.test('when requiring newrelic.js in ESM app', async () => {
2323
const { stdout, stderr } = await exec('node index.mjs', { cwd: path.join(__dirname, 'esm-js') })
24-
if (semver.gte(process.version, '22.12.0')) {
24+
if (semver.satisfies(process.version, '>=20.19.0 <22 || >=22.12.0')) {
2525
match(stdout, 'Hello esm-test')
2626
} else {
2727
match(stderr, 'ERR_REQUIRE_ESM', 'should mention ERR_REQUIRE_ESM in error message')
@@ -30,7 +30,7 @@ test('should gracefully handle ESM imports', async (t) => {
3030

3131
await t.test('when requiring newrelic.mjs in ESM app', async () => {
3232
const { stdout, stderr } = await exec('node index.mjs', { cwd: path.join(__dirname, 'esm-mjs') })
33-
if (semver.gte(process.version, '22.12.0')) {
33+
if (semver.satisfies(process.version, '>=20.19.0 <22 || >=22.12.0')) {
3434
match(stdout, 'Hello esm-test')
3535
} else {
3636
match(stderr, 'ERR_REQUIRE_ESM', 'should mention ERR_REQUIRE_ESM in error message')

0 commit comments

Comments
 (0)