diff --git a/packages/opentelemetry-test-utils/src/test-fixtures.ts b/packages/opentelemetry-test-utils/src/test-fixtures.ts index 37995ffa04..c96c5927b5 100644 --- a/packages/opentelemetry-test-utils/src/test-fixtures.ts +++ b/packages/opentelemetry-test-utils/src/test-fixtures.ts @@ -236,7 +236,7 @@ export async function runTestFixture( const collector = new TestCollector(); await collector.start(); - return new Promise(resolve => { + return new Promise((resolve, reject) => { execFile( process.execPath, opts.argv, @@ -261,6 +261,8 @@ export async function runTestFixture( if (opts.checkCollector) { await opts.checkCollector(collector); } + } catch (err) { + reject(err); } finally { collector.close(); resolve(); diff --git a/plugins/node/opentelemetry-instrumentation-hapi/test/hapi.test.ts b/plugins/node/opentelemetry-instrumentation-hapi/test/hapi.test.ts index af87e04901..48e2c51912 100644 --- a/plugins/node/opentelemetry-instrumentation-hapi/test/hapi.test.ts +++ b/plugins/node/opentelemetry-instrumentation-hapi/test/hapi.test.ts @@ -557,15 +557,24 @@ describe('Hapi Instrumentation - Core Tests', () => { }, checkCollector: (collector: TestCollector) => { const spans = collector.sortedSpans; - assert.strictEqual(spans.length, 2); - assert.strictEqual(spans[0].name, 'GET /route/{param}'); + + assert.strictEqual(spans.length, 3); + + assert.strictEqual(spans[0].name, 'GET'); assert.strictEqual( spans[0].instrumentationScope.name, '@opentelemetry/instrumentation-http' ); - assert.strictEqual(spans[1].name, 'route - /route/{param}'); + + assert.strictEqual(spans[1].name, 'GET /route/{param}'); assert.strictEqual( spans[1].instrumentationScope.name, + '@opentelemetry/instrumentation-http' + ); + + assert.strictEqual(spans[2].name, 'route - /route/{param}'); + assert.strictEqual( + spans[2].instrumentationScope.name, '@opentelemetry/instrumentation-hapi' ); },