-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve reports loading and clean code
- Improve JUnit test reports loading - Refine file patterns - Load all reports instead of only the first one - Read only top-level `<testsuite>` tags - Exclude some directories from file search - Improve the documentation - Clarify how reports are loaded - Add more examples - Clean code (quotes, semicolons, ...)
- Loading branch information
1 parent
c718821
commit 4379d86
Showing
13 changed files
with
103 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
import * as glob from '@actions/glob'; | ||
|
||
/** | ||
* Returns files and directories matching the glob patterns, | ||
* sorted by the nearest. | ||
* Returns files matching the glob patterns, | ||
* excluding some common unwanted directories from the search, | ||
* sorted by ascending depth and name. | ||
* @param {string[]} patterns Glob patterns | ||
* @return {Promise<string[]>} Files sorted by the nearest. | ||
*/ | ||
export async function globNearest(patterns) { | ||
const globber = await glob.create(patterns.join('\n')); | ||
const safePatterns = [ | ||
...patterns, | ||
'!**/.git/**', | ||
'!**/.idea/**', | ||
'!**/.vscode/**', | ||
'!**/node_modules/**', | ||
'!**/vendor/**' | ||
]; | ||
const globber = await glob.create(safePatterns.join('\n'), { | ||
followSymbolicLinks: false, | ||
implicitDescendants: false, | ||
matchDirectories: false | ||
}); | ||
const files = await globber.glob(); | ||
return files.sort((a, b) => { | ||
return (a.match(/[\\/]/g)?.length ?? 0) - (b.match(/[\\/]/g)?.length ?? 0); | ||
}) | ||
const depthDiff = (a.match(/[\\/]/g)?.length ?? 0) - (b.match(/[\\/]/g)?.length ?? 0); | ||
return depthDiff !== 0 ? depthDiff : a.localeCompare(b); | ||
}); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<testsuites name="More suites" time="0.398" tests="2" failures="0" errors="0"> | ||
<testsuite name="Suite 4" tests="2" time="0.397" failures="0" errors="0"> | ||
<testsuite name="Nested suite 4.1" tests="2" time="0.397" failures="0" errors="0"> | ||
<testcase name="Case 4.1.1" time="0.192"></testcase> | ||
<testcase name="Case 4.1.2" time="0.204"></testcase> | ||
</testsuite> | ||
</testsuite> | ||
</testsuites> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<testsuites name="Suites that should be excluded" time="9.999" tests="99" failures="19" errors="9"> | ||
<testsuite name="Ignore this" tests="99" time="9.999" failures="19" errors="9"> | ||
</testsuite> | ||
</testsuites> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters