Skip to content

Commit

Permalink
update tests in otel-core for esm
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieDanielson committed Jan 5, 2024
1 parent cc4923b commit 314292e
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {
Baggage,
BaggageEntry,
Expand All @@ -22,10 +21,10 @@ import {
propagation,
baggageEntryMetadataFromString,
} from '@opentelemetry/api';
import { W3CBaggagePropagator } from '../../src/baggage/propagation/W3CBaggagePropagator.js';
import { BAGGAGE_HEADER } from '../../src/baggage/constants.js';
import { ROOT_CONTEXT } from '@opentelemetry/api';
import * as assert from 'assert';
import { W3CBaggagePropagator } from '../../src/baggage/propagation/W3CBaggagePropagator';
import { BAGGAGE_HEADER } from '../../src/baggage/constants';

describe('W3CBaggagePropagator', () => {
const httpBaggagePropagator = new W3CBaggagePropagator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import assert = require('assert');
import * as assert from 'assert';
import { AnchoredClock } from '../../src/common/anchored-clock.js';
import { otperformance } from '../../src/platform/node/performance.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/test/common/attributes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as assert from 'assert';
import {
isAttributeValue,
sanitizeAttributes,
} from '../../src/common/attributes';
} from '../../src/common/attributes.js';

describe('attributes', () => {
describe('#isAttributeValue', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

import * as assert from 'assert';
import * as sinon from 'sinon';
import { globalErrorHandler, setGlobalErrorHandler } from '../../src';
import {
globalErrorHandler,
setGlobalErrorHandler,
} from '../../src/common/global-error-handler.js';
import { Exception } from '@opentelemetry/api';

describe('globalErrorHandler', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
import { diag } from '@opentelemetry/api';
import * as assert from 'assert';
import * as sinon from 'sinon';
import { ErrorHandler, loggingErrorHandler } from '../../src';
import { loggingErrorHandler } from '../../src/common/logging-error-handler.js';
import { ErrorHandler } from '../../src/common/types.js';

describe('loggingErrorHandler', () => {
let handler: ErrorHandler;
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/test/common/time.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as assert from 'assert';
import { otperformance as performance } from '../../src/platform';
import { otperformance as performance } from '../../src/platform/node/performance.js';
import * as sinon from 'sinon';
import * as api from '@opentelemetry/api';
import {
Expand Down
6 changes: 3 additions & 3 deletions packages/opentelemetry-core/test/internal/exporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import * as assert from 'assert';
import * as sinon from 'sinon';
import { ExportResult, ExportResultCode } from '../../src';
import * as suppress from '../../src/trace/suppress-tracing';
import { _export } from '../../src/internal/exporter';
import { ExportResult, ExportResultCode } from '../../src/ExportResult.js';
import * as suppress from '../../src/trace/suppress-tracing.js';
import { _export } from '../../src/internal/exporter.js';

describe('exporter', () => {
const sandbox = sinon.createSandbox();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as assert from 'assert';
import { validateKey, validateValue } from '../../src/internal/validators';
import { validateKey, validateValue } from '../../src/internal/validators.js';

describe('validators', () => {
describe('validateKey', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
import * as assert from 'assert';
import { RandomIdGenerator } from '../../src/platform';
import { RandomIdGenerator } from '../../src/platform/node/RandomIdGenerator.js';

const idGenerator = new RandomIdGenerator();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as assert from 'assert';
import { hexToBase64 } from '../../src/platform';
import { hexToBase64 } from '../../src/platform/node/hex-to-base64.js';

describe('hexToBase64', () => {
it('convert hex to base64', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
import * as assert from 'assert';
import * as api from '@opentelemetry/api';
import { AlwaysOffSampler } from '../../src/trace/sampler/AlwaysOffSampler';
import { AlwaysOffSampler } from '../../src/trace/sampler/AlwaysOffSampler.js';

describe('AlwaysOffSampler', () => {
it('should reflect sampler name', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
import * as assert from 'assert';
import * as api from '@opentelemetry/api';
import { AlwaysOnSampler } from '../../src/trace/sampler/AlwaysOnSampler';
import { AlwaysOnSampler } from '../../src/trace/sampler/AlwaysOnSampler.js';

describe('AlwaysOnSampler', () => {
it('should reflect sampler name', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
import * as assert from 'assert';
import * as api from '@opentelemetry/api';
import { AlwaysOnSampler } from '../../src/trace/sampler/AlwaysOnSampler';
import { ParentBasedSampler } from '../../src/trace/sampler/ParentBasedSampler';
import { AlwaysOnSampler } from '../../src/trace/sampler/AlwaysOnSampler.js';
import { ParentBasedSampler } from '../../src/trace/sampler/ParentBasedSampler.js';
import { TraceFlags, SpanKind, trace } from '@opentelemetry/api';
import { AlwaysOffSampler } from '../../src/trace/sampler/AlwaysOffSampler';
import { TraceIdRatioBasedSampler } from '../../src';
import { AlwaysOffSampler } from '../../src/trace/sampler/AlwaysOffSampler.js';
import { TraceIdRatioBasedSampler } from '../../src/trace/sampler/TraceIdRatioBasedSampler.js';

const traceId = 'd4cda95b652f4a1592b449d5929fda1b';
const spanId = '6e0c63257de34c92';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import * as assert from 'assert';
import * as api from '@opentelemetry/api';
import { TraceIdRatioBasedSampler } from '../../src/trace/sampler/TraceIdRatioBasedSampler';
import { TraceIdRatioBasedSampler } from '../../src/trace/sampler/TraceIdRatioBasedSampler.js';

const spanContext = (traceId = '1') => ({
traceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import {
W3CTraceContextPropagator,
TRACE_PARENT_HEADER,
TRACE_STATE_HEADER,
} from '../../src/trace/W3CTraceContextPropagator';
import { suppressTracing } from '../../src/trace/suppress-tracing';
import { TraceState } from '../../src/trace/TraceState';
} from '../../src/trace/W3CTraceContextPropagator.js';
import { suppressTracing } from '../../src/trace/suppress-tracing.js';
import { TraceState } from '../../src/trace/TraceState.js';

describe('W3CTraceContextPropagator', () => {
const httpTraceContext = new W3CTraceContextPropagator();
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/test/trace/tracestate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as assert from 'assert';
import { TraceState } from '../../src/trace/TraceState';
import { TraceState } from '../../src/trace/TraceState.js';

describe('TraceState', () => {
describe('.serialize()', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-core/test/utils/callback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import * as assert from 'assert';
import * as sinon from 'sinon';
import { BindOnceFuture } from '../../src';
import { assertRejects } from '../test-utils';
import { BindOnceFuture } from '../../src/utils/callback.js';
import { assertRejects } from '../test-utils.js';

describe('callback', () => {
describe('BindOnceFuture', () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/opentelemetry-core/test/utils/environment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
* limitations under the License.
*/

import { getEnv } from '../../src/platform';
import { getEnv } from '../../src/platform/node/environment.js';
import {
DEFAULT_ENVIRONMENT,
ENVIRONMENT,
RAW_ENVIRONMENT,
} from '../../src/utils/environment';
} from '../../src/utils/environment.js';
import * as assert from 'assert';
import * as sinon from 'sinon';
import { DiagLogLevel } from '@opentelemetry/api';
import { TracesSamplerValues } from '../../src';
import { TracesSamplerValues } from '../../src/utils/sampling.js';

let lastMock: RAW_ENVIRONMENT = {};

Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/test/utils/merge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
import * as assert from 'assert';
import { merge } from '../../src/utils/merge';
import { merge } from '../../src/utils/merge.js';

const tests: TestResult[] = [];

Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-core/test/utils/promise.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import * as assert from 'assert';
import { Deferred } from '../../src/utils/promise';
import { assertRejects } from '../test-utils';
import { Deferred } from '../../src/utils/promise.js';
import { assertRejects } from '../test-utils.js';

describe('promise', () => {
describe('Deferred', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/test/utils/url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import * as assert from 'assert';

import { isUrlIgnored } from '../../src';
import { isUrlIgnored } from '../../src/utils/url.js';

const urlIgnored = 'url should be ignored';
const urlNotIgnored = 'url should NOT be ignored';
Expand Down
3 changes: 2 additions & 1 deletion packages/opentelemetry-core/test/utils/wrap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

import * as assert from 'assert';

import { isWrapped, ShimWrapped } from '../../src';
import { isWrapped } from '../../src/utils/wrap.js';
import { ShimWrapped } from '../../src/common/types.js';

function makeWrapped(
wrapped: unknown,
Expand Down

0 comments on commit 314292e

Please sign in to comment.