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