forked from Azure/azure-sdk-for-js
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Azure Monitor OpenTelemetry Exporter] Remove execa in tests (Azure#2…
…2323) * Remove execa in tests * format
- Loading branch information
1 parent
d40a82e
commit 92696d3
Showing
3 changed files
with
50 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
sdk/monitor/monitor-opentelemetry-exporter/test-opentelemetry-versions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const packageJson = require("./package.json"); | ||
const { exec } = require("child_process"); | ||
|
||
const versions = ["latest"]; | ||
|
||
const packages = [ | ||
...Object.keys(packageJson.dependencies).filter((packg) => packg.startsWith("@opentelemetry")), | ||
...Object.keys(packageJson.devDependencies).filter((packg) => packg.startsWith("@opentelemetry")), | ||
]; | ||
|
||
function runProcess(cmd, callback) { | ||
var command = exec(cmd, (err, stdout, stderr) => { | ||
if (err) { | ||
console.log(`err: ${err}`); | ||
} | ||
console.log(`stdout: ${stdout}`); | ||
console.log(`stderr: ${stderr}`); | ||
}); | ||
command.on("exit", function () { | ||
callback(); | ||
}); | ||
} | ||
|
||
(async () => { | ||
try { | ||
console.log("Running opentelemetry version test against", versions); | ||
for (const version of versions) { | ||
// Note: this moves devDeps to dependencies, but it does not matter for these tests | ||
const packagesToInstall = packages.map((packg) => `${packg}@${version}`).join(" "); | ||
console.log(`Installing ${packagesToInstall}`); | ||
runProcess( | ||
`npm install --no-save --prefix ./test-opentelemetry-versions ${packagesToInstall}`, | ||
() => { | ||
console.log(`Compiling on version: ${version}`); | ||
runProcess(`npm run build`, () => { | ||
console.log(`Running tests on version: ${version}`); | ||
runProcess(`npm run test`, () => { | ||
process.exit(0); | ||
}); | ||
}); | ||
} | ||
); | ||
} | ||
} catch (error) { | ||
console.log("Opentelemetry version test failed!"); | ||
console.log(error); | ||
process.exit(1); | ||
} | ||
})(); |
45 changes: 0 additions & 45 deletions
45
sdk/monitor/monitor-opentelemetry-exporter/test-opentelemetry-versions.mjs
This file was deleted.
Oops, something went wrong.