Skip to content
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

Fix for bad node core PR exclusive labels. #34

Merged
merged 1 commit into from
Apr 28, 2016
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
7 changes: 6 additions & 1 deletion lib/node-labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ function resolveLabels (filepathsChanged) {
}

function matchExclusiveSubSystem (filepathsChanged) {
const isExclusive = filepathsChanged.every(matchesAnExclusiveLabel)
const labels = matchSubSystemsByRegex(exclusiveLabelsMap, filepathsChanged)
return labels.length === 1 ? labels : []
return (isExclusive && labels.length === 1) ? labels : []
}

function matchAllSubSystem (filepathsChanged) {
Expand Down Expand Up @@ -75,4 +76,8 @@ function withoutUndefinedValues (label) {
return label !== undefined
}

function matchesAnExclusiveLabel (filepath) {
return mappedSubSystemForFile(exclusiveLabelsMap, filepath) !== undefined
}

exports.resolveLabels = resolveLabels
14 changes: 14 additions & 0 deletions test/node-labels.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ tap.test('no labels: when ./test/ and ./doc/ files has been changed', (t) => {
t.end()
})

// This ensures older mislabelling issues doesn't happen again
// https://github.com/nodejs/node/pull/6432
// https://github.com/nodejs/node/pull/6448
tap.test('no labels: when ./test/ and ./lib/ files has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'lib/assert.js',
'test/parallel/test-assert.js'
])

t.same(labels, [])

t.end()
})

tap.test('label: "doc" when only ./doc/ files has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'doc/api/fs.md',
Expand Down