coverbadge
Advanced tools
Comparing version 0.5.4 to 0.5.5
{ | ||
"name": "coverbadge", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"description": "Create a coverage badge without any service provider.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -47,4 +47,6 @@ const path = require('path'); | ||
const downloadBadge = (url, outputPath) => { | ||
return fetch(url) | ||
const downloadBadge = (url, outputPath, token = null) => { | ||
const tokenQuery = token ? `?circle-token=${token}` : ''; | ||
return fetch(`${url}${tokenQuery}`) | ||
.then(res => res.text()) | ||
@@ -75,3 +77,3 @@ .then((svg) => { | ||
.then(artifacts => getLastBadgeURL(artifacts, outputPath)) | ||
.then(url => downloadBadge(url, outputPath)) | ||
.then(url => downloadBadge(url, outputPath, token)) | ||
}; | ||
@@ -78,0 +80,0 @@ |
@@ -163,2 +163,11 @@ import fs from 'fs'; | ||
}); | ||
it('should download the badge from url with token', async () => { | ||
fetch.__setData('svg'); | ||
const outputPath = './coverage/badges.svg'; | ||
await downloadBadge('url', outputPath, 'token'); | ||
expect(fetch).toHaveBeenCalledWith('url?circle-token=token'); | ||
}); | ||
}); | ||
@@ -165,0 +174,0 @@ |
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
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
134013
938
36