Change include path for lines of code counting

Previously, we were always using `**` in the include path. the
effect of this was to always count lines in the entire
repository unless explicitly added to the paths-ignore. This
was incorrect behaviour. Now we only using `**` if the include
path is otherwise empty.
This commit is contained in:
Andrew Eisenberg 2021-05-13 16:35:47 +00:00
parent a77f6b0a58
commit 8e61fc214a
6 changed files with 30 additions and 6 deletions

10
lib/count-loc.test.js generated
View file

@ -40,7 +40,15 @@ ava_1.default("ensure lines of code can handle includes", async (t) => {
// directories outside the normal structure.
const results = await count_loc_1.countLoc(path.join(__dirname, "../tests/multi-language-repo"), ["../../src/testdata"], [], [languages_1.Language.javascript], logging_1.getRunnerLogger(true));
t.deepEqual(results, {
javascript: 15,
javascript: 12,
});
});
ava_1.default("ensure lines of code can handle empty includes", async (t) => {
// note that "**" is always included. The includes are for extra
// directories outside the normal structure.
const results = await count_loc_1.countLoc(path.join(__dirname, "../tests/multi-language-repo"), ["idontexist"], [], [languages_1.Language.javascript], logging_1.getRunnerLogger(true));
t.deepEqual(results, {
// should get no results
});
});
ava_1.default("ensure lines of code can handle exclude", async (t) => {