diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a56d40..da09f6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [2.2.2] - 2025-07-03 + +- Ensure that we correctly pass the metadata the BugSnag CLI create build command (#100) + ## [2.2.1] - 2025-05-27 - Ensure we expose all options in the Webpack plugin that are available in the Bugsnag CLI (#99) diff --git a/build-reporter-plugin.js b/build-reporter-plugin.js index c1aaf17..f1e416b 100644 --- a/build-reporter-plugin.js +++ b/build-reporter-plugin.js @@ -62,12 +62,14 @@ class BugsnagBuildReporterPlugin { const optionalOpts = { autoAssignRelease: opts.build.autoAssignRelease, builderName: opts.build.builderName, - metadata: opts.build.metadata, + metadata: Object.entries(opts.build.metadata) + .map(([key, value]) => `${key}=${value}`) + .join(','), provider: opts.build.sourceControl.provider, repository: opts.build.sourceControl.repository, revision: opts.build.sourceControl.revision, releaseStage: opts.build.releaseStage, - buildApiRootUrl: opts.build.endpoint, + buildApiRootUrl: opts.build.endpoint || opts.options.endpoint, logLevel: opts.build.logLevel || opts.options.logLevel, dryRun: opts.build.dryRun || opts.options.dryRun, verbose: opts.build.verbose || opts.options.verbose, diff --git a/test/build-reporter-plugin.test.mjs b/test/build-reporter-plugin.test.mjs index 58f0bc5..e72d1f0 100644 --- a/test/build-reporter-plugin.test.mjs +++ b/test/build-reporter-plugin.test.mjs @@ -21,7 +21,7 @@ test('BugsnagBuildReporterPlugin', t => { }) test('it sends upon successful build', t => { - t.plan(3) + t.plan(4) const server = createServer((req, res) => { let body = '' req.on('data', (d) => { body += d }) @@ -37,6 +37,7 @@ test('it sends upon successful build', t => { t.ok(j, 'json body was received') t.equal(j.appVersion, '1.2.3', 'body should contain app version') t.equal(j.apiKey, 'YOUR_API_KEY', 'body should contain api key') + t.same(j.metadata, { foo: 'bar', baz: 'qux' }, 'body should contain correct metadata') }) }) server.listen() diff --git a/test/fixtures/a/webpack.config.js b/test/fixtures/a/webpack.config.js index e673c14..bf111e5 100644 --- a/test/fixtures/a/webpack.config.js +++ b/test/fixtures/a/webpack.config.js @@ -10,7 +10,11 @@ module.exports = { new BugsnagBuildReporterPlugin({ apiKey: 'YOUR_API_KEY', appVersion: '1.2.3', - endpoint: `http://localhost:${process.env.PORT}` + endpoint: `http://localhost:${process.env.PORT}`, + metadata: { + foo: 'bar', + baz: 'qux' + } }) ] }