From f3123d0c1852e1bd033bd408c686226b387c0e34 Mon Sep 17 00:00:00 2001 From: Bhushan Palsapure Date: Tue, 18 Mar 2025 11:06:33 +0000 Subject: [PATCH 1/7] chore: Updated actions versions --- .github/workflows/deploy.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 40c8049..d398468 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,11 +15,12 @@ jobs: matrix: node-version: [16.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: 'npm' - name: Install Dependencies run: | npm install @@ -28,7 +29,7 @@ jobs: run: npm run test:ci - name: Upload Test Results if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: test-results path: | @@ -40,17 +41,18 @@ jobs: needs: test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js 16.x - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: 16.x + cache: 'npm' - name: Install Dependencies run: npm install - name: Build run: npm run build - name: Upload Build Artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: build-output path: ./build @@ -60,9 +62,9 @@ jobs: runs-on: ubuntu-latest if: github.ref == 'refs/heads/master' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Download Build Artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: build-output path: ./build @@ -70,4 +72,4 @@ jobs: uses: peaceiris/actions-gh-pages@v3 with: deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} - publish_dir: ./build + publish_dir: ./build \ No newline at end of file From eeecf127c16bf625615ba7f32de14a02c3f26bce Mon Sep 17 00:00:00 2001 From: Bhushan Palsapure Date: Mon, 24 Mar 2025 14:23:37 +0000 Subject: [PATCH 2/7] chore: Cleanup, Removed test code for demo --- gulpfile.js | 20 +- karma.conf.ci.js | 64 ++- reports/junit/test-results.xml | 134 +++---- src/app/app-routing.module.ts | 2 - src/app/app.module.ts | 13 - .../components/footer/footer.component.html | 81 +--- src/app/components/footer/footer.component.ts | 23 +- .../components/header/header.component.html | 278 +------------ .../header/header.component.spec.ts | 36 -- src/app/components/header/header.component.ts | 7 - src/app/components/home/home.component.html | 366 +++++++++--------- src/app/components/home/home.module.ts | 6 - .../vf-back-to-top.component.html | 103 +---- .../vf-back-to-top.component.spec.ts | 2 +- .../vf-back-to-top.component.ts | 53 +-- .../vf-badge/vf-badge.component.html | 139 +------ .../vf-badge/vf-badge.component.spec.ts | 2 +- .../components/vf-badge/vf-badge.component.ts | 49 +-- .../vf-banner/vf-banner.component.html | 253 +----------- .../vf-banner/vf-banner.component.spec.ts | 2 +- .../vf-banner/vf-banner.component.ts | 101 +---- .../vf-blockquote.component.html | 134 +------ .../vf-blockquote.component.spec.ts | 2 +- .../vf-blockquote/vf-blockquote.component.ts | 63 +-- .../vf-button/vf-button.component.html | 189 +-------- .../components/vf-hero/vf-hero.component.html | 299 +------------- .../vf-hero/vf-hero.component.spec.ts | 2 +- .../components/vf-hero/vf-hero.component.ts | 79 +--- .../components/vf-tabs/vf-tabs.component.html | 176 +-------- .../vf-tabs/vf-tabs.component.spec.ts | 2 +- .../components/vf-tabs/vf-tabs.component.ts | 57 +-- src/styles.scss | 38 -- 32 files changed, 370 insertions(+), 2405 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 373861f..564e184 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -8,11 +8,16 @@ function runNgTest(options = []) { const command = `ng test ${options.join(' ')}`; const child = exec(command); + let output = ''; + let errorOutput = ''; + child.stdout.on('data', (data) => { + output += data; process.stdout.write(data); }); child.stderr.on('data', (data) => { + errorOutput += data; process.stderr.write(data); }); @@ -20,7 +25,10 @@ function runNgTest(options = []) { if (code === 0) { resolve(); } else { - reject(new Error(`ng test failed with code ${code}`)); + const error = new Error(`ng test failed with code ${code}`); + error.stdout = output; + error.stderr = errorOutput; + reject(error); } }); }); @@ -34,13 +42,15 @@ gulp.task('test:ci', async () => { '--browsers=ChromeHeadless', '--code-coverage', '--source-map=true', - '--progress=false', - '--reporters=junit,coverage', + '--progress=true', + '--reporters=spec,junit,coverage', '--karma-config=karma.conf.ci.js' ]); } catch (error) { - console.error('CI Test execution failed:', error); - process.exit(1); // Ensure pipeline fails on test errors + console.error('CI Test execution failed:'); + if (error.stdout) console.log('Test output:', error.stdout); + if (error.stderr) console.error('Test errors:', error.stderr); + process.exit(1); } }); diff --git a/karma.conf.ci.js b/karma.conf.ci.js index 35166dc..52130b3 100644 --- a/karma.conf.ci.js +++ b/karma.conf.ci.js @@ -8,35 +8,83 @@ module.exports = function(config) { browsers: ['ChromeHeadless'], autoWatch: false, singleRun: true, + client: { + clearContext: false, + jasmine: { + failFast: true + } + }, plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage'), require('karma-junit-reporter'), + require('karma-spec-reporter'), require('karma-sonarqube-unit-reporter'), require('@angular-devkit/build-angular/plugins/karma') ], - reporters: ['progress', 'junit', 'coverage', 'sonarqube'], + reporters: ['spec', 'junit', 'coverage'], + + // Detailed spec reporter configuration + specReporter: { + maxLogLines: 5, // limit number of lines logged per test + suppressErrorSummary: false, // print error summary + suppressFailed: false, // print information about failed tests + suppressPassed: false, // print information about passed tests + suppressSkipped: false, // print information about skipped tests + showSpecTiming: true, // print the time elapsed for each spec + failFast: false // test would finish with error when a first fail occurs + }, + + // JUnit reporter configuration junitReporter: { outputDir: 'reports/junit', outputFile: 'test-results.xml', useBrowserName: false, - nameFormatter: undefined, - classNameFormatter: undefined, + classNameFormatter: (browser, result) => { + return result.suite.join(' › '); + }, + nameFormatter: (browser, result) => { + return result.description; + }, properties: {} }, + + // Coverage reporter configuration coverageReporter: { dir: 'coverage', reporters: [ + { type: 'html', subdir: 'html' }, { type: 'lcov', subdir: 'lcov' }, { type: 'text-summary' }, + { type: 'json-summary', subdir: '.', file: 'coverage-summary.json' }, { type: 'cobertura', subdir: '.', file: 'cobertura.xml' } - ] + ], + check: { + global: { + statements: 75, + branches: 75, + functions: 75, + lines: 75 + } + } + }, + // Add configuration for SonarQube reporter + sonarQubeUnitReporter: { + sonarQubeVersion: 'LATEST', + outputFile: 'reports/ut_report.xml', + useBrowserName: false, + testPaths: ['./src'], + testFilePattern: '.spec.ts', + overrideTestDescription: true, + // Add this to prevent null reference errors + testExecutions: {} }, - sonarqubeReporter: { - outputFile: 'reports/sonarqube/report.xml', - useBrowserName: false - } + // Prevent disconnect on slow tests + browserDisconnectTimeout: 10000, + browserDisconnectTolerance: 3, + browserNoActivityTimeout: 60000, + captureTimeout: 60000 }); }; diff --git a/reports/junit/test-results.xml b/reports/junit/test-results.xml index b9875a0..413eb83 100644 --- a/reports/junit/test-results.xml +++ b/reports/junit/test-results.xml @@ -1,87 +1,87 @@ - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - +,Chrome Headless 134.0.0.0 (Mac OS 10.15.7) LOG: null ]]> diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 88ef15a..f1086cf 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,7 +1,5 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -// import { AppNavigationComponent } from './components/navigation/navigation.component'; // Import the NavigationComponent -// import { VfActivityGroupComponent } from './components/vf-activity-group/vf-activity-group.component'; import { VfBannerComponent } from './components/vf-banner/vf-banner.component'; import { VfBadgeComponent } from './components/vf-badge/vf-badge.component'; import { VfBlockquoteComponent } from './components/vf-blockquote/vf-blockquote.component'; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 0bf8866..6832230 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -6,15 +6,8 @@ import { AppComponent } from './app.component'; import { HomeModule } from './components/home/home.module'; import { AppRoutingModule } from './app-routing.module'; import { AppHeaderModule } from './components/header/header.module'; -// import { AppHeroModule } from './components/hero/hero.module'; -// import { AppSearchBarModule } from './components/search-bar/search-bar.module'; -// import { AppPopularSectionsModule } from './components/popular-sections/popular-sections.module'; -// import { AppStarterPackagesModule } from './components/starter-packages/starter-packages.module'; -// import { AppPrebuiltCdnModule } from './components/prebuilt-cdn/prebuilt-cdn.module'; import { AppFooterModule } from './components/footer/footer.module'; import { VfComponentsModule } from './components/vf-components.module'; -// import { VfBackToTopModule } from './components/vf-back-to-top/vf-back-to-top.module'; - @NgModule({ declarations: [ AppComponent @@ -25,14 +18,8 @@ import { VfComponentsModule } from './components/vf-components.module'; HomeModule, AppRoutingModule, AppHeaderModule, - // AppHeroModule, - // AppSearchBarModule, - // AppPopularSectionsModule, - // AppStarterPackagesModule, - // AppPrebuiltCdnModule, AppFooterModule, VfComponentsModule, - // VfBackToTopModule ], bootstrap: [AppComponent], schemas: [NO_ERRORS_SCHEMA] diff --git a/src/app/components/footer/footer.component.html b/src/app/components/footer/footer.component.html index f599b5d..9164d02 100644 --- a/src/app/components/footer/footer.component.html +++ b/src/app/components/footer/footer.component.html @@ -1,57 +1,4 @@ - - -