-
Notifications
You must be signed in to change notification settings - Fork 39
test: added esm test for tedious #2253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| // If we require tedious here, it will load the dependency from the | ||
| // node_modules folder of the collector package. | ||
| // TODO: https://jsw.ibm.com/browse/INSTA-7722 | ||
| const tedious = require('../../../../../node_modules/tedious'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I auto-resolved this. We have to ensure we are using the right Tedious instance.
Its better to install Tedious in the local app folder to be 100% sure we are loading the right instance.
| } | ||
| execSync('npm install --no-save --no-package-lock --prefix ./ ./core.tgz', { | ||
|
|
||
| execSync('npm install --save --prefix ./ ./core.tgz', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI if we dont use --save, multiple execSync commands will remove previous installations. Using package.json with save + gitignore.
| return; | ||
| } | ||
|
|
||
| execSync('rm package-lock.json', { cwd: __dirname, stdio: 'inherit' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| execSync('rm package-lock.json', { cwd: __dirname, stdio: 'inherit' }); |
| if (process.env.RUN_ESM && !opts.execArgv) { | ||
| const esmLoader = [`--import=${path.join(__dirname, '..', '..', 'esm-register.mjs')}`]; | ||
| const esmLoader = [ | ||
| `--import=${opts.esmLoaderPath ? opts.esmLoaderPath : path.join(__dirname, '..', '..', 'esm-register.mjs')}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otel integration has its complete own testing space (we dont use anything from outside). Offering a way to specify the esm handler inside the otel app space.
| } | ||
|
|
||
| execSync('rm -rf package-lock.json', { cwd: __dirname, stdio: 'inherit' }); | ||
| execSync('rm -rf package.json', { cwd: __dirname, stdio: 'inherit' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both files in gitignore.
|
| const restifyTest = semver.gte(process.versions.node, '24.0.0') ? describe.skip : describe; | ||
| let restifyTest = semver.gte(process.versions.node, '24.0.0') ? describe.skip : describe; | ||
|
|
||
| if (process.env.RUN_ESM === 'true') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to manually skip them because currently we don't have a strategy when multiple describes/apps are in one test file and some of them have esm support and some not. Just skipping them manually for now (not ideal).
| if (process.env.INSTANA_TEST_SKIP_INSTALLING_DEPS !== 'true') { | ||
| const rootPackageJson = require('../../../../../package.json'); | ||
| const tediousVersion = rootPackageJson.devDependencies.tedious; | ||
| execSync(`npm i "tedious@${tediousVersion}" --prefix ./ --save`, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually installing tedious into our otel test application space. Full production simulation. No more require tedious from root.



I noticed we don't have any ESM tests for Otel integration. Added one to proof its working.
refs #2221