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

covwatcher

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

covwatcher - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

2

package.json
{
"name": "covwatcher",
"version": "1.3.0",
"version": "1.4.0",
"description": "A server to diff clover coverage xmls and post results to bitbucket",

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

@@ -34,3 +34,3 @@ import './mock-config'

connection: 'close',
'content-length': '511',
'content-length': '547',
'content-type': 'image/svg+xml',

@@ -89,4 +89,6 @@ vary: 'Accept-Encoding',

})
.put('/rest/api/1.0/users/slug/repos/name/pull-requests/12345/comments/1')
.reply(200, { version: 1, id: 1 })
.get('/rest/api/1.0/users/slug/repos/name/pull-requests/12345/comments/1')
.reply(200, { version: 2, id: 1 })
.put('/rest/api/1.0/users/slug/repos/name/pull-requests/12345/comments/1', { version: 2, text: /.*/})
.reply(200, { version: 3, id: 1 })

@@ -93,0 +95,0 @@ await supertest(router)

@@ -12,2 +12,3 @@ import { Bitbucket } from '../bitbucket'

Bitbucket: {
get: jest.fn(() => Promise.resolve({ id: 0, version: 2 })),
put: jest.fn(() => Promise.resolve({ id: 0, version: 1 })),

@@ -20,3 +21,3 @@ post: jest.fn(() => Promise.resolve({ id: 0, version: 1 })),

}))
jest.mock('../../../utils/parsing/create-comment', () => ({ createCommentObject: jest.fn(() => 'testcomment') }))
jest.mock('../../../utils/parsing/create-comment', () => ({ createCommentObject: jest.fn(() => ({ text: 'testcomment' })) }))
jest.mock('../../../utils/parsing/diff', () => ({ diffReports: jest.fn(() => 'diff') }))

@@ -48,3 +49,4 @@

expect(createCommentObject).toBeCalledWith('diff', testcomment)
expect(Bitbucket.put).toBeCalledWith('users/slug/repos/name/pull-requests/12345/comments/commentId', 'testcomment')
expect(Bitbucket.get).toBeCalledWith('users/slug/repos/name/pull-requests/12345/comments/commentId')
expect(Bitbucket.put).toBeCalledWith('users/slug/repos/name/pull-requests/12345/comments/commentId', { text: 'testcomment', version: 2 })
expect(commentDb.set).toBeCalledWith(repository, pr.name, { ...testcomment, version: 1 })

@@ -61,3 +63,3 @@ })

expect(createCommentObject).toBeCalledWith('diff', undefined)
expect(Bitbucket.post).toBeCalledWith('users/slug/repos/name/pull-requests/12345/comments/', 'testcomment')
expect(Bitbucket.post).toBeCalledWith('users/slug/repos/name/pull-requests/12345/comments/', { text: 'testcomment' })
expect(commentDb.set).toBeCalledWith(repository, pr.name, { commentId: '0', version: 1 })

@@ -64,0 +66,0 @@ })

@@ -41,5 +41,6 @@ const request = require('request-promise-native')

return request(config).catch(
internalError(2, `Error sending ${method}-request to ${url} with payload:\n ${JSON.stringify(body, null, 2)}`),
)
return request(config).catch((err) => {
internalError(2, `Error sending ${method}-request to ${url} with payload:\n ${JSON.stringify(body, null, 2)}`)(err)
return Promise.reject('Error while accessing Bitbucket API.')
})
}

@@ -18,6 +18,8 @@ import { Bitbucket } from './bitbucket'

function updateComment(comment: Core.CommentRest, existingComment: Core.Comment, pr: Core.PullRequest): Promise<Core.Comment> {
return Bitbucket.put(createApiSlug(pr, existingComment.commentId), comment).then(({ version }) =>
commentDb.set(pr.repository, pr.name, { commentId: existingComment.commentId, version }),
)
async function updateComment(comment: Core.CommentRest, existingComment: Core.Comment, pr: Core.PullRequest): Promise<Core.Comment> {
const { version: currentVersion } = await Bitbucket.get(createApiSlug(pr, existingComment.commentId))
comment.version = currentVersion
const { version: newVersion } = await Bitbucket.put(createApiSlug(pr, existingComment.commentId), comment)
return commentDb.set(pr.repository, pr.name, { commentId: existingComment.commentId, version: newVersion })
}

@@ -24,0 +26,0 @@

@@ -38,3 +38,4 @@ import { addBranchReport, addPullRequestReport } from './controllers'

logger: ({ level, message }) => logger(Math.floor(level * 2), ' - router - ', message),
bodyParserOptions: { limit: '50mb'}
},
)

@@ -9,5 +9,5 @@ const svgBaseUrl = `http://${global.address}:${global.port}/svg`

optimal: `![top](${svgBaseUrl}/top.svg)`,
decrease: `![decrease](${svgBaseUrl}/long-arrow-down.svg)`,
increase: `![improvement](${svgBaseUrl}/long-arrow-up.svg)`,
new: `![new](${svgBaseUrl}/magic.svg)`,
decrease: `![decrease](${svgBaseUrl}/arrow-down.svg)`,
increase: `![improvement](${svgBaseUrl}/arrow-up.svg)`,
new: `![new](${svgBaseUrl}/new.svg)`,
}

@@ -34,3 +34,3 @@

'### Coverage Statistics',
`#### ${covSymbol} This pull request has a diff coverage of ${diffCoverage}% and will ${totalDiff > 0 ? 'decrease' : 'increase'}` +
`#### ${covSymbol} This pull request has a diff coverage of ${diffCoverage}% and will ${totalDiff < 0 ? 'decrease' : 'increase'}` +
` total coverage by ${Math.abs(totalDiff)}% to ${diff.total.changed.statementCov}%.`,

@@ -61,4 +61,5 @@ '',

const covSymbol = statementCov < 0 ? symbolsMap.decrease : symbolsMap.increase
const diffCell = `${covSymbol} ${Math.round(statementCov)}% (${original.coveredStatements}:arrow_right:${coveredStatements})`
const newCoverageCell = `${Math.round(statementCov)}% (${coveredStatements}/${changed.statements})`
const diffPercentage = `${statementCov < 0 ? '-' : '+'}${Math.abs(Math.round(statementCov))}%`
const diffCell = `${covSymbol} ${diffPercentage} (${original.coveredStatements} :arrow_right: ${coveredStatements})`
const newCoverageCell = `${Math.round(changed.statementCov)}% (${coveredStatements}/${changed.statements})`

@@ -65,0 +66,0 @@ return `| ${getSymbolFromCoverage(changed)} | ${name} | ${diffCell} | ${newCoverageCell} |`

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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