Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [18.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
Expand All @@ -28,29 +29,31 @@ 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
name: test-results-${{ github.run_id }}
path: |
reports/junit/test-results.xml
coverage/lcov/lcov.info
coverage/cobertura.xml
overwrite: true

build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.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
Expand All @@ -60,9 +63,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
Expand Down
4 changes: 3 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
"styles": [
"src/styles.scss"
],
"scripts": []
"scripts": [
"src/assets/vf-tabs/vf-tabs.js"
]
},
"configurations": {
"production": {
Expand Down
40 changes: 24 additions & 16 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,48 @@ 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);
});

child.on('close', (code) => {
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);
}
});
});
}

// Task to run all tests in CI mode
gulp.task('test:ci', async () => {
try {
await runNgTest([
'--no-watch',
'--browsers=ChromeHeadless',
'--code-coverage',
'--source-map=true',
'--progress=false',
'--reporters=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
}
gulp.task('test:ci', () => {
return runNgTest([
'--no-watch',
'--browsers=ChromeHeadless',
'--code-coverage',
'--source-map=true',
'--progress=true',
'--reporters=spec,junit,coverage',
'--karma-config=karma.conf.ci.js'
]).catch(error => {
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);
});
});

// Task to run all tests including VF components
Expand Down
64 changes: 56 additions & 8 deletions karma.conf.ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: 50,
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
});
};
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = function (config) {
global: {
statements: 80,
branches: 80,
functions: 75,
functions: 50,
lines: 80
}
}
Expand Down
Loading
Loading