bugsnag-build-reporter
Advanced tools
Comparing version 1.0.0-2 to 1.0.0-3
@@ -28,7 +28,7 @@ #!/usr/bin/env node | ||
bugsnag-builds \\ | ||
bugsnag-build-reporter \\ | ||
--api-key cc814aead128d38d0767094327b4784a \\ | ||
--app-version 1.3.5 | ||
bugsnag-builds \\ | ||
bugsnag-build-reporter \\ | ||
-k cc814aead128d38d0767094327b4784a \\ | ||
@@ -86,2 +86,2 @@ -v 1.3.5 | ||
// console.log(argv.input) | ||
require('../index')(argv.flags, process.cwd()) | ||
require('../index')(argv.flags, { path: process.cwd() }) |
@@ -16,3 +16,3 @@ const makePayload = require('./lib/payload') | ||
if (error.errors) { | ||
log.error(error.errors.map(e => ` ${e}`).join('')) | ||
log.error(` ${error.errors.join(', ')}`) | ||
} else { | ||
@@ -19,0 +19,0 @@ log.error(`Error detail…\n${error.stack}`) |
@@ -24,2 +24,3 @@ const nullUndefinedOr = fn => value => { | ||
releaseStage: optionalString, | ||
buildTool: optionalString, | ||
metadata: { | ||
@@ -26,0 +27,0 @@ validate: nullUndefinedOr(value => { |
@@ -38,3 +38,3 @@ const findNearest = require('find-nearest-file') | ||
if (/^git@gitlab\.com|https:\/\/gitlab.com/.test(repo)) return 'gitlab' | ||
if (/^git@bitbucket\.org|https:\/\/bitbucket.org/.test(repo)) return 'bitbucket' | ||
if (/^git@bitbucket\.org|https:\/\/bitbucket.org|ssh:\/\/hg@bitbucket\.org|https:\/\/\w+@bitbucket\.org\//.test(repo)) return 'bitbucket' | ||
return null | ||
@@ -44,2 +44,3 @@ } | ||
const extractPackageJsonRepoInfo = (path, log, cb) => { | ||
if (!path) return cb(null, null) | ||
readFile(path, 'utf8', (err, data) => { | ||
@@ -46,0 +47,0 @@ if (err) { |
@@ -11,3 +11,3 @@ const test = require('tape') | ||
t.equal(err.errors.length, 2) | ||
t.deepEqual(err.errors, [ 'apiKey: is required', 'appVersion: is required' ]) | ||
t.deepEqual(err.errors, [ 'apiKey is required (got "undefined")', 'appVersion is required (got "undefined")' ]) | ||
t.end() | ||
@@ -29,4 +29,4 @@ }) | ||
t.deepEqual(err.errors, [ | ||
'metadata: may be an object with key/value pairs where the only permitted values are strings', | ||
'sourceControl: must be an object containing { provider, repository, revision }' | ||
'metadata may be an object with key/value pairs where the only permitted values are strings (got "{ nested: { objs: [ \'are\', \'not\', \'allowed\' ] } }")', | ||
'sourceControl must be an object containing { provider, repository, revision } (got "{ foo: 10 }")' | ||
]) | ||
@@ -49,4 +49,4 @@ t.end() | ||
t.deepEqual(err.errors, [ | ||
'metadata: may be an object with key/value pairs where the only permitted values are strings', | ||
'sourceControl: must be an object containing { provider, repository, revision }' | ||
'metadata may be an object with key/value pairs where the only permitted values are strings (got "\'aaaa\'")', | ||
'sourceControl must be an object containing { provider, repository, revision } (got "1")' | ||
]) | ||
@@ -53,0 +53,0 @@ t.end() |
const test = require('tape') | ||
const proxyquire = require('proxyquire') | ||
const mockHttps = { request: () => {} } | ||
const send = proxyquire('../send', { | ||
'https': mockHttps | ||
const http = require('http') | ||
const send = require('../send') | ||
test('send(): successful', t => { | ||
t.plan(1) | ||
const server = http.createServer((req, res) => { | ||
let body = '' | ||
req.on('data', (d) => { body += d }) | ||
req.on('end', () => { | ||
res.end('ok') | ||
let j | ||
try { | ||
j = JSON.parse(body) | ||
} catch (e) { | ||
t.fail('failed to parse body as json') | ||
} | ||
t.ok(j, 'json body was received') | ||
}) | ||
}) | ||
server.listen() | ||
send(`http://localhost:${server.address().port}`, {}, () => { | ||
server.close() | ||
t.end() | ||
}, (err) => { | ||
server.close() | ||
t.end(err) | ||
}) | ||
}) | ||
const EventEmitter = require('events') | ||
test('send', t => { | ||
mockHttps.request = () => { | ||
test('send(): unsuccessful (500)', t => { | ||
t.plan(2) | ||
const server = http.createServer((req, res) => { | ||
res.statusCode = 500 | ||
res.end('error') | ||
}) | ||
server.listen() | ||
send(`http://localhost:${server.address().port}`, {}, () => { | ||
server.close() | ||
t.fail('send should not succeed') | ||
}, (err) => { | ||
server.close() | ||
t.ok(err) | ||
t.equal(err.message, 'HTTP status 500 received from builds API') | ||
t.end() | ||
return Object.assign(new EventEmitter(), { write: () => {}, end: () => {} }) | ||
} | ||
send('https://builds.bugsnag.com', {}, () => {}, () => {}) | ||
}) | ||
}) | ||
test('send(): unsuccessful (400)', t => { | ||
t.plan(3) | ||
const server = http.createServer((req, res) => { | ||
res.statusCode = 400 | ||
res.setHeader('content-type', 'application/json') | ||
res.end('{ "errors": [ "flipflop is not a valid crankworble" ] }') | ||
}) | ||
server.listen() | ||
send(`http://localhost:${server.address().port}`, {}, () => { | ||
server.close() | ||
t.fail('send should not succeed') | ||
}, (err) => { | ||
server.close() | ||
t.ok(err) | ||
t.equal(err.message, 'Invalid payload sent to builds API') | ||
t.deepEqual(err.errors, [ 'flipflop is not a valid crankworble' ]) | ||
t.end() | ||
}) | ||
}) | ||
test('send(): unsuccessful (400, bad json)', t => { | ||
t.plan(2) | ||
const server = http.createServer((req, res) => { | ||
res.statusCode = 400 | ||
res.setHeader('content-type', 'application/json') | ||
res.end('{ "err') | ||
}) | ||
server.listen() | ||
send(`http://localhost:${server.address().port}`, {}, () => { | ||
server.close() | ||
t.fail('send should not succeed') | ||
}, (err) => { | ||
server.close() | ||
t.ok(err) | ||
t.equal(err.message, 'HTTP status 400 received from builds API') | ||
t.end() | ||
}) | ||
}) |
@@ -10,4 +10,4 @@ const inspect = require('util').inspect | ||
const err = new Error('Configuration error') | ||
err.errors = errors.map(e => `${e.key}: ${e.message}, got: ${e.value}`) | ||
err.errors = errors.map(e => `${e.key} ${e.message} (got "${e.value}")`) | ||
cb(err) | ||
} |
{ | ||
"name": "bugsnag-build-reporter", | ||
"version": "1.0.0-2", | ||
"version": "1.0.0-3", | ||
"description": "A tool for reporting your application's builds to Bugsnag", | ||
@@ -13,6 +13,8 @@ "main": "index.js", | ||
"devDependencies": { | ||
"directory-copy": "^0.1.0", | ||
"nyc": "^11.4.1", | ||
"proxyquire": "^1.8.0", | ||
"standard": "^10.0.3", | ||
"tape": "^4.8.0" | ||
"tape": "^4.8.0", | ||
"tempy": "^0.2.1" | ||
}, | ||
@@ -23,2 +25,3 @@ "dependencies": { | ||
"find-nearest-file": "^1.1.0", | ||
"meow": "^4.0.0", | ||
"minimist": "^1.2.0", | ||
@@ -25,0 +28,0 @@ "pino": "^4.10.3", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 6 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54712
64
598
7
6
3
11
+ Addedmeow@^4.0.0
+ Addedarray-find-index@1.0.2(transitive)
+ Addedarrify@1.0.1(transitive)
+ Addedcamelcase@4.1.0(transitive)
+ Addedcamelcase-keys@4.2.0(transitive)
+ Addedcurrently-unhandled@0.4.1(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddecamelize-keys@1.1.1(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedfind-up@2.1.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedindent-string@3.2.0(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedis-plain-obj@1.1.0(transitive)
+ Addedjson-parse-better-errors@1.0.2(transitive)
+ Addedload-json-file@4.0.0(transitive)
+ Addedlocate-path@2.0.0(transitive)
+ Addedloud-rejection@1.6.0(transitive)
+ Addedmap-obj@1.0.12.0.0(transitive)
+ Addedmeow@4.0.1(transitive)
+ Addedminimist-options@3.0.2(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addedp-limit@1.3.0(transitive)
+ Addedp-locate@2.0.0(transitive)
+ Addedp-try@1.0.0(transitive)
+ Addedparse-json@4.0.0(transitive)
+ Addedpath-exists@3.0.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@3.0.0(transitive)
+ Addedpify@3.0.0(transitive)
+ Addedquick-lru@1.1.0(transitive)
+ Addedread-pkg@3.0.0(transitive)
+ Addedread-pkg-up@3.0.0(transitive)
+ Addedredent@2.0.0(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.20(transitive)
+ Addedstrip-bom@3.0.0(transitive)
+ Addedstrip-indent@2.0.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtrim-newlines@2.0.0(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)