| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a77f6b0 commit 8e61fc2
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,7 +63,23 @@ test("ensure lines of code can handle includes", async (t) => { | |||
| 63 | 63 | ); | |
| 64 | 64 | ||
| 65 | 65 | t.deepEqual(results, { | |
| 66 | - javascript: 15, | ||
| 66 | + javascript: 12, | ||
| 67 | + }); | ||
| 68 | + }); | ||
| 69 | + | ||
| 70 | + test("ensure lines of code can handle empty includes", async (t) => { | ||
| 71 | + // note that "**" is always included. The includes are for extra | ||
| 72 | + // directories outside the normal structure. | ||
| 73 | + const results = await countLoc( | ||
| 74 | + path.join(__dirname, "../tests/multi-language-repo"), | ||
| 75 | + ["idontexist"], | ||
| 76 | + [], | ||
| 77 | + [Language.javascript], | ||
| 78 | + getRunnerLogger(true) | ||
| 79 | + ); | ||
| 80 | + | ||
| 81 | + t.deepEqual(results, { | ||
| 82 | + // should get no results | ||
| 67 | 83 | }); | |
| 68 | 84 | }); | |
| 69 | 85 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,7 +69,7 @@ export async function countLoc( | |||
| 69 | 69 | ): Promise<Partial<Record<Language, number>>> { | |
| 70 | 70 | const result = await new LocDir({ | |
| 71 | 71 | cwd, | |
| 72 | - include: ["**"].concat(include || []), | ||
| 72 | + include: Array.isArray(include) && include.length > 0 ? include : ["**"], | ||
| 73 | 73 | exclude, | |
| 74 | 74 | analysisLanguages: dbLanguages.flatMap((lang) => nameToLinguist[lang]), | |
| 75 | 75 | }).loadInfo(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments