Skip to content

Commit

Permalink
test: fixed test for typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
abhilash-sivan committed Oct 4, 2024
1 parent 688ebc2 commit 748237f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ const config = require('@instana/core/test/config');
const ProcessControls = require('../../../../test_util/ProcessControls');
const globalAgent = require('../../../../globalAgent');
const testUtils = require('@instana/core/test/test_util');
const semver = require('semver');
const supportedVersion = require('@instana/core').tracing.supportedVersion;

describe('Typescript TS->JS', function () {
const mochaSuiteFn =
supportedVersion(process.versions.node) && semver.gte(process.versions.node, '18.0.0') ? describe : describe.skip;

mochaSuiteFn('Typescript TS->JS', function () {
this.timeout(config.getTestTimeout() * 5);

describe('[CASE 1]', () => {
mochaSuiteFn('[CASE 1]', () => {
globalAgent.setUpCleanUpHooks();
const agentControls = globalAgent.instance;

Expand Down Expand Up @@ -56,7 +61,7 @@ describe('Typescript TS->JS', function () {
});
});

describe('[CASE 2]', () => {
mochaSuiteFn('[CASE 2]', () => {
globalAgent.setUpCleanUpHooks();
const agentControls = globalAgent.instance;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ const ProcessControls = require('../../../../test_util/ProcessControls');
const globalAgent = require('../../../../globalAgent');
const testUtils = require('@instana/core/test/test_util');
const isLatestEsmSupportedVersion = require('@instana/core').tracing.isLatestEsmSupportedVersion;
const semver = require('semver');
const supportedVersion = require('@instana/core').tracing.supportedVersion;

const mochaSuiteFn =
supportedVersion(process.versions.node) && semver.gte(process.versions.node, '18.0.0') ? describe : describe.skip;

const loaderPath = isLatestEsmSupportedVersion(process.versions.node)
? ['--import', path.join(__dirname, 'node_modules', '@instana', 'collector', 'esm-register.mjs')]
: ['--experimental-loader', path.join(__dirname, 'node_modules', '@instana', 'collector', 'esm-loader.mjs')];

describe('Typescript TS->ESM', function () {
mochaSuiteFn('Typescript TS->ESM', function () {
this.timeout(config.getTestTimeout() * 5);

describe('[CASE 1]', () => {
mochaSuiteFn('[CASE 1]', () => {
globalAgent.setUpCleanUpHooks();
const agentControls = globalAgent.instance;

Expand Down Expand Up @@ -62,7 +68,7 @@ describe('Typescript TS->ESM', function () {
});
});

describe('[CASE 2]', () => {
mochaSuiteFn('[CASE 2]', () => {
globalAgent.setUpCleanUpHooks();
const agentControls = globalAgent.instance;

Expand Down

0 comments on commit 748237f

Please sign in to comment.