Skip to content

Commit c690ab9

Browse files
committed
adjustments for catching jest test failures
1 parent 4deba9f commit c690ab9

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

.github/workflowScripts/checkJestTestCoverage.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
11

2+
$expectedJestTestFailedSummaryPath = "./coverage/jest-results.json"
3+
if ( -not(Test-Path $expectedJestTestFailedSummaryPath) ) {
4+
Write-Error "No JEST test File Generated"
5+
exit 1
6+
}
7+
8+
$failedTestResults = $jestTest.testResults | Where-Object { $_.status -eq "failed" }
9+
if ( $failedTestResults.count -gt 0 ) {
10+
Write-Error "FAILED JEST TESTS - SEE BELOW:"
11+
$failedTestResults | Select-Object { $_ } -ExpandProperty message
12+
exit 1
13+
}
14+
15+
$jestTest = Get-Content -Raw -Path $expectedJestTestFailedSummaryPath | ConvertFrom-Json
16+
if ($jestTest.numFailedTests ) {
17+
Write-Error "Failed Jest Tests: ${ $jestTest.numFailedTests } "
18+
}
19+
220
$expectedTestCoverageSummaryPath = "./coverage/coverage-summary.json"
321
if ( -not(Test-Path $expectedTestCoverageSummaryPath) ) {
422
Write-Error "No Coverage Summary File Generated"
23+
exit 1
524
}
625

726
$coverageSummary = Get-Content -Raw -Path $expectedTestCoverageSummaryPath | ConvertFrom-Json

developmentSupportAndScripts/resetAndInitiateJestCoverageTest.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if ( $runJestTests ) {
2626
}
2727

2828
### RUN CONVERAGE TESTS
29-
npm run jest-test
29+
npm run jest-test-summary
3030

3131
### OPEN UP COVERAGE REPORT IN BROWSER BASED ON EXPECTED ROOT DIRECTORY CREATION OF COVERAGE FOLDER
3232
start ./coverage/lcov-report/index.html

src/treecipe/src/FakerService/NPMFakerService/tests/NPMFakerService.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ describe('NPMFakerService Shared Intstance Tests', () => {
1616
const referenceValuePlaceholder = '"TODO -- REFERENCE ID REQUIRED"';
1717
const seeOnePagerPlaceholder = '"SEE ONE PAGER - https://gist.github.com/jdschleicher/4abfd188a933598833285ee76e560445"';
1818

19-
console.log("heeyooo : " );
20-
21-
2219
test('Text field returns correct npm faker expression', () => {
2320
expect(fieldTypeToNPMFakerMappings['text']).toBe('{{ faker.lorem.text(50) }}');
2421
});

0 commit comments

Comments
 (0)