Skip to content

Commit bad2954

Browse files
committed
test: restore testing of Azure Functions on node >=18.x
This removes the workaround added in #3281. The core issue was fixed in [email protected] Fixes: #3279
1 parent 2409aa7 commit bad2954

File tree

3 files changed

+177
-376
lines changed

3 files changed

+177
-376
lines changed

test/instrumentation/azure-functions/azure-functions.test.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ const treekill = require('tree-kill')
2020
const { MockAPMServer } = require('../../_mock_apm_server')
2121
const { formatForTComment } = require('../../_utils')
2222

23-
if (semver.satisfies(process.version, '>=18')) {
24-
console.log(`# SKIP azure-functions-core-tools is currently busted for node >=18.x (currently running node ${process.version}): see https://github.com/elastic/apm-agent-nodejs/issues/3279 and https://github.com/Azure/azure-functions-core-tools/issues/3335`)
25-
process.exit()
26-
} else if (!semver.satisfies(process.version, '>=14 <19')) {
23+
if (!semver.satisfies(process.version, '>=14 <19')) {
2724
console.log(`# SKIP Azure Functions runtime ~4 does not support node ${process.version} (https://aka.ms/functions-node-versions)`)
2825
process.exit()
2926
} else if (os.platform() === 'win32') {
@@ -484,6 +481,15 @@ tape.test('azure functions', function (suite) {
484481
// Allow some time for an early fail of `func start`, e.g. if there is
485482
// already a user of port 7071...
486483
const onEarlyClose = code => {
484+
// Warning/Limitation: The 'npm ci' above installs platform-specific
485+
// binaries to "$fnAppDir/node_modules/azure-functions-core-tools/...",
486+
// which means a local test run on macOS followed by an attempted test run
487+
// in Docker will result in a crash:
488+
// node_tests_1 | # ["func start" stderr] /app/test/instrumentation/azure-functions/fixtures/AJsAzureFnApp/node_modules/azure-functions-core-tools/bin/func: 1: Syntax error: "(" unexpected
489+
// node_tests_1 | not ok 2 "func start" failed early: code=2
490+
// For now the workaround is to manually clean that tree before running
491+
// tests on a separate OS:
492+
// rm -rf test/instrumentation/azure-functions/fixtures/AJsAzureFnApp/node_modules
487493
t.fail(`"func start" failed early: code=${code}`)
488494
fnAppProc = null
489495
clearTimeout(earlyCloseTimer)

0 commit comments

Comments
 (0)