Skip to content

Tests for ./scripts/release-post.js #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"serve": "node build.js serve",
"load-versions": "node scripts/load-versions.js",
"start": "npm run serve",
"test": "standard build.js scripts/*.js scripts/**/*.js"
"test": "standard build.js scripts/*.js scripts/**/*.js tests/**/*.js && tape tests/**/*.test.js | faucet"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -46,7 +46,12 @@
"strftime": "^0.9.2"
},
"devDependencies": {
"faucet": "0.0.1",
"nock": "^2.12.0",
"pre-commit": "^1.1.1",
"standard": "^5.3.0"
"proxyquire": "^1.7.2",
"sinon": "^1.17.0",
"standard": "^5.3.0",
"tape": "^4.2.0"
}
}
37 changes: 23 additions & 14 deletions scripts/release-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ function download (url) {
// ## 2015-08-04, Version 3.0.0, @rvagg
const rxReleaseSection = /## \d{4}-\d{2}-\d{2}, Version ([^,( ]+)[\s\S]*?(?=## \d{4})/g

function explicitVersion () {
const versionArg = process.argv[2]
return versionArg ? Promise.resolve(versionArg) : Promise.reject()
function explicitVersion (version) {
return version ? Promise.resolve(version) : Promise.reject()
}

function findLatestVersion (cb) {
Expand Down Expand Up @@ -151,14 +150,24 @@ function slugify (str) {
return str.replace(/\./g, '-')
}

explicitVersion()
.then(null, findLatestVersion)
.then(fetchDocs)
.then(renderPost)
.then(writeToFile)
.then(function (filepath) {
console.log('Release post created:', filepath)
}, function (err) {
console.error('Some error occured here!', err.stack)
process.exit(1)
})
exports.explicitVersion = explicitVersion
exports.fetchShasums = fetchShasums
exports.writeToFile = writeToFile
exports.findLatestVersion = findLatestVersion
exports.verifyDownloads = verifyDownloads
exports.fetchChangelog = fetchChangelog

if (require.main === module) {
explicitVersion(process.argv[2])
.then(null, findLatestVersion)
.then(fetchDocs)
.then(renderPost)
.then(writeToFile)
.then(function (filepath) {
console.log('Release post created:', filepath)
}, function (err) {
console.error('Some error occured here!', err.stack)
process.exit(1)
})
}

Loading