forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: issue with trailing slash in matching coverageThreshold keys
- Loading branch information
1 parent
a293b75
commit 4832d23
Showing
5 changed files
with
19 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -269,7 +269,7 @@ export default class CoverageReporter extends BaseReporter { | |
const pathOrGlobMatches = thresholdGroups.reduce< | ||
Array<[string, string]> | ||
>((agg, thresholdGroup) => { | ||
const absoluteThresholdGroup = path.resolve(thresholdGroup); | ||
const absoluteThresholdGroup = path.resolve(thresholdGroup) + (thresholdGroup.length > 1 && thresholdGroup[thresholdGroup.length - 1] === path.sep ? path.sep : ''); | ||
This comment has been minimized.
Sorry, something went wrong.
j3tan
|
||
|
||
// The threshold group might be a path: | ||
|
||
|
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 |
---|---|---|
|
@@ -44,7 +44,9 @@ beforeEach(() => { | |
'non_covered_file.js': '', | ||
'relative_path_file.js': '', | ||
}; | ||
|
||
fileTree[`${process.cwd()}/path-test`] = { | ||
'100pc_coverage_file.js': '', | ||
}; | ||
mock(fileTree); | ||
}); | ||
|
||
|
@@ -79,6 +81,10 @@ describe('onRunComplete', () => { | |
statements: {covered: 5, pct: 50, skipped: 0, total: 10}, | ||
}; | ||
const fileCoverage = [ | ||
[ | ||
'./path-test/100pc_coverage_file.js', | ||
{statements: {covered: 10, pct: 100, total: 10}}, | ||
], | ||
['./path-test-files/covered_file_without_threshold.js'], | ||
['./path-test-files/full_path_file.js'], | ||
['./path-test-files/relative_path_file.js'], | ||
|
@@ -306,6 +312,9 @@ describe('onRunComplete', () => { | |
{ | ||
collectCoverage: true, | ||
coverageThreshold: { | ||
'./path-test/': { | ||
statements: 100, | ||
}, | ||
'./path-test-files/': { | ||
statements: 50, | ||
}, | ||
|
@@ -367,11 +376,14 @@ describe('onRunComplete', () => { | |
{ | ||
collectCoverage: true, | ||
coverageThreshold: { | ||
'./path-test/100pc_coverage_file.js': { | ||
statements: 100, | ||
}, | ||
'./path-test-files/100pc_coverage_file.js': { | ||
statements: 100, | ||
}, | ||
global: { | ||
statements: 50, | ||
statements: 55.55, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
wespickett
Author
Owner
|
||
}, | ||
}, | ||
}, | ||
|
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
probably an error? These are version bumps are handled separate, usually with a lerna command