Socket
Socket
Sign inDemoInstall

opbeat-release-tracker

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opbeat-release-tracker - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

17

index.js

@@ -17,2 +17,3 @@ 'use strict'

if (!cb) cb = noop
if (!defaults.auto && !opts.rev) return process.nextTick(cb.bind(null, new Error('Required git revision not provided')))

@@ -23,5 +24,6 @@ var cwd = opts.cwd || defaults.cwd || process.cwd()

if (err) return cb(err)
opts.rev = opts.rev || results[0]
opts.status = opts.status || 'completed'
opts.branch = opts.branch || results[1]
if (results[0]) opts.rev = results[0]
if (results[1]) opts.branch = results[1]
if (!opts.status) opts.status = 'completed'
if (!opts.rev) return cb(new Error('No git revision found'))
client.request('releases', opts, function (err, res, body) {

@@ -45,5 +47,5 @@ if (err) return cb(err)

if (!opts.rev) git.rev(cwd, next())
if (!opts.rev && defaults.auto) git.rev(cwd, next())
else process.nextTick(next())
if (!opts.branch) git.branch(cwd, next())
if (!opts.branch && defaults.auto) git.branch(cwd, next())
else process.nextTick(next())

@@ -55,3 +57,6 @@ }

if (!opts) opts = {}
var defaults = { cwd: opts.cwd }
var defaults = {
cwd: opts.cwd,
auto: 'auto' in opts ? opts.auto : true
}
return getTracker(Client({

@@ -58,0 +63,0 @@ appId: opts.appId || process.env.OPBEAT_APP_ID,

{
"name": "opbeat-release-tracker",
"version": "1.0.1",
"version": "1.1.0",
"description": "Stand-alone release tracker for Opbeat",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -36,2 +36,5 @@ # opbeat-release-tracker

`OPBEAT_SECRET_ID` environment variable)
- `auto` - If `true` (default) opbeat-release-tracker will try to
auto-detect the git rev and/or branch if not specifically given. Set
to `false` to disable this behavior
- `cwd` - Directory where to auto-detect git rev or branch if those are

@@ -38,0 +41,0 @@ not provided when tracking a release (falls back to `process.cwd()`)

@@ -68,4 +68,4 @@ 'use strict'

rev: results[0],
status: 'completed',
branch: results[1]
branch: results[1],
status: 'completed'
}

@@ -110,4 +110,4 @@

rev: 'my-rev',
status: 'completed',
branch: branch
branch: branch,
status: 'completed'
}

@@ -211,3 +211,50 @@

test('track - error', function (t) {
test('track - no auto', function (t) {
var body = {
rev: 'my-rev',
status: 'completed'
}
zlib.deflate(JSON.stringify(body), function (err, buffer) {
t.error(err)
var scope = nock('https://intake.opbeat.com')
.filteringRequestBody(function (body) {
t.equal(body, buffer.toString('hex'))
return 'ok'
})
.post('/api/v1/organizations/test-org-id/apps/test-app-id/releases/', 'ok')
.reply(202)
var tracker = ReleaseTracker({
appId: 'test-app-id',
organizationId: 'test-org-id',
secretToken: 'test-token',
auto: false
})
tracker({ rev: body.rev }, function (err) {
scope.done()
t.error(err)
t.end()
})
})
})
test('track - no auto and no rev', function (t) {
var tracker = ReleaseTracker({
appId: 'test-app-id',
organizationId: 'test-org-id',
secretToken: 'test-token',
auto: false
})
tracker(function (err) {
t.ok(util.isError(err))
t.equals(err.message, 'Required git revision not provided')
t.end()
})
})
test('track - http error', function (t) {
var scope = nock('https://intake.opbeat.com')

@@ -232,3 +279,3 @@ .filteringRequestBody(function () { return 'ok' })

test('track - no callback and error', function (t) {
test('track - no callback and http error', function (t) {
var scope = nock('https://intake.opbeat.com')

@@ -235,0 +282,0 @@ .filteringRequestBody(function () { return 'ok' })

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