Skip to content

Instantly share code, notes, and snippets.

@vuldin
Created March 24, 2020 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vuldin/79a5d2966f4489bc43bd4a44bf8df440 to your computer and use it in GitHub Desktop.
Save vuldin/79a5d2966f4489bc43bd4a44bf8df440 to your computer and use it in GitHub Desktop.
Testing debugbear javscript API
const { DebugBear } = require("debugbear");
const envCi = require("env-ci");
// DEBUGBEAR_API_KEY=<key> $(npm bin)/debugbear --pageId=6383 --waitForResult --baseBranch=master --inferBuildInfo
// https://www.debugbear.com/viewResult/969114
(async function run() {
const { commit: commitHash } = envCi();
console.log(`commitHash: ${commitHash}`);
const debugbear = new DebugBear(process.env.DEBUGBEAR_API_KEY);
const analysis = await debugbear.pages.analyze(6383, {
// Commit Hash is required to generate a build
commitHash,
customHeaders: {
"X-Enable-Experiment": "true"
}
});
const result = await analysis.waitForResult();
console.log(result);
console.log(result.build.status); // "success"
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment