diff --git a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts index b4c6f0ade0..1030203a2c 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts @@ -360,8 +360,8 @@ describe('PrometheusExporter', () => { .get('http://localhost:9464/metrics', res => { errorHandler(done)(new Error('unreachable')); }) - .on('error', err => { - assert(`${err}`.match('ECONNREFUSED')); + .on('error', (err: any) => { + assert.equal(err.code, 'ECONNREFUSED'); done(); }); });