Skip to content

Commit

Permalink
fix(license): don't fail when license is whitespace-only field (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan authored and zkat committed Mar 7, 2018
1 parent 9948ecf commit df8ea05
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/fixer.js
Expand Up @@ -299,7 +299,8 @@ var fixer = module.exports = {
} else{
if (
typeof(data.license) !== 'string' ||
data.license.length < 1
data.license.length < 1 ||
data.license.trim() === ''
) {
this.warn("invalidLicense")
} else {
Expand Down
19 changes: 19 additions & 0 deletions test/normalize.js
Expand Up @@ -156,6 +156,25 @@ tap.test("license field should be a valid SPDX expression", function(t) {
t.end()
})

tap.test("don't fail when license is just a space", function(t) {
var warnings = []
function warn(w) {
warnings.push(w)
}
var a
normalize(a={
license: ' '
}, warn)

var expect =
[ warningMessages.missingDescription,
warningMessages.missingRepository,
warningMessages.missingReadme,
warningMessages.invalidLicense]
t.same(warnings, expect)
t.end()
})

tap.test("gist bugs url", function(t) {
var d = {
repository: "git@gist.github.com:123456.git"
Expand Down

0 comments on commit df8ea05

Please sign in to comment.