-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
As the title says, skipSubdirs still compares directories themselves. Not sure what the intended functionality is, but I expected it to be ignored all together in the compare.
This extends gliviu/dir-compare-cli#1
File structure
.\compare
│ d_file2.txt
│ m_file1.txt
│ m_file3.txt
│
├───directory1
│ d_file2.txt
│ m_file1.txt
│ m_file3.txt
│
└───directory2
d_file2.txt
m_file1.txt
m_file3.txt
Reproduction Script
const diff = require("dir-compare")
const options = {
skipSubdirs: true,
}
const input = {
path1: "./compare/directory1",
path2: "./compare/",
}
diff
.compare(input.path1, input.path2, options)
.then((results) => {
results.diffSet.forEach((d) => {
const differenceString = `${d.relativePath}${d.name1} (${d.type1}): ${d.state} - ${d.name2} (${d.type2})`
console.log(differenceString)
})
})
.catch((error) => {
throw new Error(error)
})Outputs
> node .\test.js
\undefined (missing): right - directory1 (directory)
\undefined (missing): right - directory2 (directory)
\d_file2.txt (file): equal - d_file2.txt (file)
\m_file1.txt (file): equal - m_file1.txt (file)
\m_file3.txt (file): equal - m_file3.txt (file)
With skipSubdirs: false
> node .\test.js
\undefined (missing): right - directory1 (directory)
\directory1undefined (missing): right - d_file2.txt (file)
\directory1undefined (missing): right - m_file1.txt (file)
\directory1undefined (missing): right - m_file3.txt (file)
\undefined (missing): right - directory2 (directory)
\directory2undefined (missing): right - d_file2.txt (file)
\directory2undefined (missing): right - m_file1.txt (file)
\directory2undefined (missing): right - m_file3.txt (file)
\d_file2.txt (file): equal - d_file2.txt (file)
\m_file1.txt (file): equal - m_file1.txt (file)
\m_file3.txt (file): equal - m_file3.txt (file)edit- typo
Metadata
Metadata
Assignees
Labels
No labels