Skip to content

Commit

Permalink
test: fix instrumentation tests (#1832)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcdo29 authored Oct 23, 2024
2 parents b9fb691 + 71cbe47 commit 05b0503
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/instrumentation/test/ogma.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const EnabledInstrumentationSuite = suite<OgmaInstrumentationSuiteContext>(
{
testInjection: (logger: OgmaClass, writeSpy: hanbi.Stub<Writable['write']>, span: Span) => {
logger.info(kMessage);
is(writeSpy.calls, 1);
is(writeSpy.calls.size, 1);
const record = JSON.parse(writeSpy.firstCall.args[0].toString());
const { traceId, spanId, traceFlags } = span.spanContext();
equal(record.meta['trace_id'], traceId);
Expand All @@ -47,7 +47,7 @@ const EnabledInstrumentationSuite = suite<OgmaInstrumentationSuiteContext>(
},
testNoInjection: (logger: OgmaClass, writeSpy: hanbi.Stub<Writable['write']>) => {
logger.info(kMessage);
is(writeSpy.calls, 1);
is(writeSpy.calls.size, 1);
const record = JSON.parse(writeSpy.firstCall.args[0].toString());
equal(record.meta?.['trace_id'], undefined);
equal(record.meta?.['span_id'], undefined);
Expand All @@ -67,7 +67,8 @@ const EnabledInstrumentationSuite = suite<OgmaInstrumentationSuiteContext>(
EnabledInstrumentationSuite.before((ctx) => {
ctx.instrumentation = new OgmaInstrumentation();
ctx.instrumentation.enable();
ctx.Ogma = require('@ogma/logger');
// eslint-disable-next-line @typescript-eslint/no-var-requires
ctx.Ogma = require('@ogma/logger').Ogma;
});
EnabledInstrumentationSuite.before.each((ctx) => {
ctx.stream = new Writable();
Expand Down

0 comments on commit 05b0503

Please sign in to comment.