Skip to content

Commit

Permalink
MC-9766 Final repo changes to support multi-project
Browse files Browse the repository at this point in the history
* Make sure distribution build still works
* Update jest reporters to output report files to new locations
* Update Jenkins build to reference correct file locations
* Update npm scripts
* Clean up redundant files
  • Loading branch information
pjmonks committed Jan 19, 2022
1 parent 970f9e8 commit 369193c
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 1,359 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ $RECYCLE.BIN/

# Windows shortcuts
*.lnk
/test-report.xml
/test-report
junit.xml
**/test-report
yarn.lock
eslint_report.*
.scannerwork
Expand Down
10 changes: 4 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ pipeline {
}
stage('Jenkins Clean') {
steps {
sh 'rm -f junit.xml'
sh 'rm -rf test-report'
sh 'rm -rf coverage'
sh 'rm -f eslint_report.json'
}
}

Expand Down Expand Up @@ -88,15 +86,15 @@ pipeline {
}
post {
always {
junit allowEmptyResults: true, testResults: 'junit.xml'
junit allowEmptyResults: true, testResults: 'test-report/mdm-ui/junit.xml'
}
}
}
stage('Lint') {
steps {
nvm('') {
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
sh 'npm run eslint-report'
sh 'npm run eslint-xml'
}
}
}
Expand Down Expand Up @@ -217,8 +215,8 @@ pipeline {
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : false,
reportDir : 'test-report',
reportFiles : 'index.html',
reportDir : 'test-report/mdm-ui',
reportFiles : 'jest-report.html',
reportName : 'Test Report',
reportTitles : 'Test'
])
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ $ npm install

### Run the application

To start the application in development mode run `ng serve`. After the terminal finishes compiling, open up your browser and navigate to http://localhost:4200.
To start the application in development mode run `npm start`. After the terminal finishes compiling, open up your browser and navigate to http://localhost:4200.

Alternatively:

```bash
# Explicitly state which Angular project to test
npm start mdm-ui
```

### Testing the application

Expand All @@ -55,6 +62,10 @@ npm run test mdm-ui
npm run test mdm-ui -- --watch
```

## Build the application

To 'export' the code for production, run `ng build --configuration production`. This will compile & minify the code, making it ready for production.

### Deployments

All pushes to the repository will invoke a Jenkins CI build.
Expand Down Expand Up @@ -106,8 +117,4 @@ This is surprisingly simple just run `npm install` or `npm ci`

There is a useful npm package ([symlinked](https://www.npmjs.com/package/symlinked)) which can list what modules are linked into your repository.
This is helpful if you want to check if mdm-resources is currently linked to mdm-ui.
We recommend installing this globally with `npm i -g symlinked` then you can call it inside mdm-ui using `symlinked names`.

## Build the application

To 'export' the code for production, run `ng build --prod` this will compile & minify the code, making it ready for production
We recommend installing this globally with `npm i -g symlinked` then you can call it inside mdm-ui using `symlinked names`.
Empty file removed TESTING.md
Empty file.
1,329 changes: 0 additions & 1,329 deletions dependencies-2020-05-22.csv

This file was deleted.

5 changes: 0 additions & 5 deletions jesthtmlreporter.config.json

This file was deleted.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"dist": "ng build --configuration production --output-path=dist/mdm-ui-$npm_package_version && npm run dist-archive",
"dist-archive": "tar zcvf dist/mdm-ui-${npm_package_version}.tgz -C dist mdm-ui-$npm_package_version",
"test": "ng test",
"dist": "ng build mdm-ui --configuration production --output-path=dist/mdm-ui-$npm_package_version && npm run dist-archive",
"dist-archive": "tar zcvf dist/mdm-ui-${npm_package_version}.tgz -C dist mdm-ui-$npm_package_version",
"eslint": "tsc --noEmit && eslint . --ext ts --fix",
"eslint-nofix": "tsc --noEmit && eslint . --ext ts",
"eslint-html": "tsc --noEmit && eslint . --ext ts --fix --format html -o eslint_report.html",
"eslint-report": "eslint . --ext ts --format checkstyle -o eslint_report.xml",
"e2e": "ng e2e",
"eslint-html": "eslint . --ext ts --format html -o test-report/eslint_report.html",
"eslint-xml": "eslint . --ext ts --format checkstyle -o test-report/eslint_report.xml",
"postinstall": "ngcc",
"sonar": "sonar-scanner -Dsonar.projectVersion=$npm_package_version",
"license-check": "license-check-and-add -f license-check-and-add-config.json"
Expand Down
14 changes: 11 additions & 3 deletions projects/mdm-ui/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,17 @@ module.exports = {
},
reporters: [
'default',
'jest-junit',
['jest-html-reporter', { pageTitle: 'Test Report' }],
['jest-sonar', { outputDirectory: 'test-report' }]
['jest-junit', {
outputDirectory: "test-report/mdm-ui"
}],
['jest-html-reporter', {
pageTitle: "Mauro Data Mapper User Interface: Test Results",
outputPath: "test-report/mdm-ui/jest-report.html",
includeFailureMsg: true
}],
['jest-sonar', {
outputDirectory: "test-report/mdm-ui"
}]
],
watchPathIgnorePatterns: ['test-report/', 'junit.xml'],
transformIgnorePatterns: [
Expand Down
2 changes: 1 addition & 1 deletion projects/mdm-ui/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.
SPDX-License-Identifier: Apache-2.0
*/
const packageFile = require('../../package.json');
const packageFile = require('../../../../package.json');

export const environment = {
production: true,
Expand Down
2 changes: 1 addition & 1 deletion projects/mdm-ui/src/setupJest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ SPDX-License-Identifier: Apache-2.0
* the @angular-builders/jest facade, this internally calls 'jest-preset-angular/setup-jest' for you. Calling it
* twice will produce an error.
*/
//import 'jest-preset-angular/setup-jest';
// import 'jest-preset-angular/setup-jest';

// import './jestGlobalMocks'; // browser mocks globally available for every test

0 comments on commit 369193c

Please sign in to comment.