diff --git a/.gitignore b/.gitignore index aac8407eef5..0e656d44d27 100644 --- a/.gitignore +++ b/.gitignore @@ -104,4 +104,5 @@ package-lock.json yarn.lock out versions +docs/test.js !test/node_modules diff --git a/docs/package.json b/docs/package.json index 7add08b5dc8..1ac0afb8ba0 100644 --- a/docs/package.json +++ b/docs/package.json @@ -4,7 +4,7 @@ "main": "typedoc.js", "scripts": { "build": "typedoc", - "test": "tsc --noEmit test" + "test": "tsc test && node test" }, "license": "BSD-3-Clause", "private": true, diff --git a/docs/test.ts b/docs/test.ts index eb48fe115b3..b5455e41f0a 100644 --- a/docs/test.ts +++ b/docs/test.ts @@ -3,7 +3,6 @@ import { HTTP_HEADERS } from '../ext/formats'; let span: Span; let context: SpanContext; -let scope: Scope; let traceId: string; let spanId: string; @@ -92,12 +91,6 @@ tracer.use('router'); tracer.use('when'); tracer.use('winston'); -tracer.inject(span || span.context(), HTTP_HEADERS, {}); -context = tracer.extract(HTTP_HEADERS, {}); - -traceId = context.toTraceId(); -spanId = context.toSpanId(); - span = tracer.startSpan('test'); span = tracer.startSpan('test', {}); span = tracer.startSpan('test', { @@ -109,6 +102,16 @@ span = tracer.startSpan('test', { } }); +const carrier = {} + +tracer.inject(span || span.context(), HTTP_HEADERS, carrier); +context = tracer.extract(HTTP_HEADERS, carrier); + +traceId = context.toTraceId(); +spanId = context.toSpanId(); + +const scope = tracer.scope() + span = scope.active(); scope.activate(span, () => {}); diff --git a/index.js b/index.js index 44106e01bd8..a0d7b0de717 100644 --- a/index.js +++ b/index.js @@ -7,3 +7,5 @@ const TracerProxy = require('./src/proxy') platform.use(node) module.exports = new TracerProxy() +module.exports.default = module.exports +module.exports.tracer = module.exports