Commit 37a8f34c authored by Christopher Fullarton's avatar Christopher Fullarton

Adds line coverage output to the unit tests

parent 8ed9ea11
Pipeline #34164 passed with stages
in 15 minutes and 25 seconds
......@@ -3,11 +3,9 @@ stages:
- test
- build
- assets
- sync_sentry
- deploy
- build-beta
- assets-beta
- sync_sentry-beta
- deploy-beta
# Cache modules in between jobs
......@@ -37,7 +35,6 @@ ts_lint:
npm_test:
stage: test
allow_failure: true
tags:
- nodejs
- angular
......@@ -91,28 +88,6 @@ generate_assets:
paths:
- dist
sync_sentry:
stage: sync_sentry
allow_failure: true
only:
- master
tags:
- nodejs
dependencies:
- generate_assets
script:
- npm install @sentry/cli
- echo "Create a new release $CI_COMMIT_SHA"
#- export SENTRY_URL=$SENTRY_BASE_URL
- export SENTRY_AUTH_TOKEN=$SENTRY_BASE_TOKEN
- export SENTRY_ORG=$SENTRY_BASE_ORGANIZATION
- export SENTRY_PROJECT=$SENTRY_BASE_PROJECT
- node_modules/@sentry/cli/bin/sentry-cli releases new $CI_COMMIT_SHA
- node_modules/@sentry/cli/bin/sentry-cli releases set-commits --auto $CI_COMMIT_SHA
- node_modules/@sentry/cli/bin/sentry-cli releases files $CI_COMMIT_SHA upload-sourcemaps $CI_PROJECT_DIR/dist -x .js -x .map --validate --verbose --rewrite --strip-common-prefix
- node_modules/@sentry/cli/bin/sentry-cli releases finalize $CI_COMMIT_SHA
- echo "Finalized release for $CI_COMMIT_SHA"
deploy:
stage: deploy
only:
......@@ -175,28 +150,6 @@ generate_assets-beta:
paths:
- dist
sync_sentry-beta:
stage: sync_sentry-beta
allow_failure: true
only:
- beta
tags:
- nodejs
dependencies:
- generate_assets-beta
script:
- npm install @sentry/cli
- echo "Create a new release $CI_COMMIT_SHA"
#- export SENTRY_URL=$SENTRY_BASE_URL
- export SENTRY_AUTH_TOKEN=$SENTRY_BASE_TOKEN
- export SENTRY_ORG=$SENTRY_BASE_ORGANIZATION
- export SENTRY_PROJECT=$SENTRY_BASE_PROJECT
- node_modules/@sentry/cli/bin/sentry-cli releases new $CI_COMMIT_SHA
- node_modules/@sentry/cli/bin/sentry-cli releases set-commits --auto $CI_COMMIT_SHA
- node_modules/@sentry/cli/bin/sentry-cli releases files $CI_COMMIT_SHA upload-sourcemaps $CI_PROJECT_DIR/dist -x .js -x .map --validate --verbose --rewrite --strip-common-prefix
- node_modules/@sentry/cli/bin/sentry-cli releases finalize $CI_COMMIT_SHA
- echo "Finalized release for $CI_COMMIT_SHA"
deploy-beta:
stage: deploy-beta
only:
......
......@@ -26,8 +26,8 @@
"build:PROD:DEPLOY": "npm run build:PROD && npm run purify",
"build:PROD-STATS": "ng build --prod --stats-json",
"bundle-report": "webpack-bundle-analyzer dist/browser/stats.json",
"test": "ng test --browsers=ChromeHeadless --watch=false --source-map=false",
"test:DEV": "ng test --browsers=Chrome --karma-config=src/karma.conf.dev.js --source-map=false",
"test": "ng test --browsers=ChromeHeadless --watch=false --source-map=false --code-coverage",
"test:DEV": "ng test --browsers=Chrome --karma-config=src/karma.conf.dev.js --source-map=false --code-coverage",
"test:DEV:HEADLESS": "ng test --browsers=ChromeHeadless --karma-config=src/karma.conf.dev.js --source-map=false",
"lint": "ng lint",
"e2e": "ng e2e --port 4201",
......
......@@ -6,7 +6,6 @@ import { distinctUntilChanged, map, takeUntil } from 'rxjs/operators';
import { DEVICE_TYPES, LIVE_PREVIEW_ENVIRONMENT } from '../../../environments/environment';
import { AbstractChoiceQuestionEntity } from '../../lib/entities/question/AbstractChoiceQuestionEntity';
import { ConnectionService } from '../../service/connection/connection.service';
import { CustomMarkdownService } from '../../service/custom-markdown/custom-markdown.service';
import { QuestionTextService } from '../../service/question-text/question-text.service';
import { QuizService } from '../../service/quiz/quiz.service';
......@@ -53,8 +52,7 @@ export class LivePreviewComponent implements OnInit, OnDestroy {
public questionTextService: QuestionTextService,
public connectionService: ConnectionService,
private quizService: QuizService,
private sanitizer: DomSanitizer,
private route: ActivatedRoute, private markdownService: CustomMarkdownService,
private sanitizer: DomSanitizer, private route: ActivatedRoute,
) {
}
......
import { HttpClient } from '@angular/common/http';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { ErrorHandler, NgModule, PLATFORM_ID } from '@angular/core';
import { BrowserModule, BrowserTransferStateModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
......@@ -148,7 +148,7 @@ export function markedOptionsFactory(): MarkedOptions {
useFactory: jwtOptionsFactory,
deps: [PLATFORM_ID],
},
}), PipesModule, HeaderModule, MarkdownModule.forRoot({
}), PipesModule, HeaderModule, HttpClientModule, MarkdownModule.forRoot({
markedOptions: {
provide: MarkedOptions,
useFactory: (markedOptionsFactory),
......
......@@ -78,7 +78,6 @@ describe('MemberGroupSelectComponent', () => {
component.addToGroup('testGroup');
expect(component.addToGroup).not.toThrowError();
expect(router.navigate).toHaveBeenCalledWith(['/nicks', 'input']);
})));
});
});
......@@ -13,11 +13,12 @@ module.exports = function (config) {
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
captureConsole: false
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage'),
reports: ['html', 'lcovonly'],
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
customLaunchers: {
......@@ -34,9 +35,7 @@ module.exports = function (config) {
mime: {
'text/x-typescript': ['ts', 'tsx']
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
: ['progress', 'kjhtml'],
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
......
......@@ -10,21 +10,21 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('karma-mocha-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
captureConsole: false
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage'),
reports: ['html', 'lcovonly'],
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
customLaunchers: {
ChromeHeadless: {
base: 'Chrome',
flags: [
ChromeHeadless: {
base: 'Chrome',
flags: [
'--headless',
'--disable-gpu',
'--no-sandbox',
......@@ -33,16 +33,14 @@ module.exports = function (config) {
}
},
mime: {
'text/x-typescript': ['ts','tsx']
'text/x-typescript': ['ts', 'tsx']
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
: ['mocha'],
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['ChromeHeadless'],
singleRun: true
singleRun: true,
});
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment