Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bugsnag-build-reporter

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bugsnag-build-reporter - npm Package Compare versions

Comparing version 1.0.0-2 to 1.0.0-3

lib/test/fixtures/git/_git/COMMIT_EDITMSG

6

bin/cli.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc