tslint.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
"noEmitHelpers": true,
"importHelpers": true,
"strictNullChecks": false,
"lib": [
"dom",
"es6"
],
"baseUrl": "./src",
"paths": {
"@angular/*": ["node_modules/@angular/*"]
},
"typeRoots": [
"node_modules/@types"
],
"types": [
"jasmine",
"node"
]
},
"exclude": [
"node_modules",
"dist"
],
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
base.spec.ts
import "core-js"
import "zone.js/dist/zone";
import "zone.js/dist/long-stack-trace-zone";
import "zone.js/dist/proxy";
import "zone.js/dist/sync-test";
import "zone.js/dist/jasmine-patch";
import "zone.js/dist/async-test";
import "zone.js/dist/fake-async-test";
import { TestBed } from "@angular/core/testing";
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from "@angular/platform-browser-dynamic/testing";
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
karma.config.js
module.exports = function(config) {
config.set({
frameworks: ["jasmine", "karma-typescript"],
files: [
{ pattern: "base.spec.ts" },
{ pattern: "app/**/*.+(ts|html)" }
],
preprocessors: {
"**/*.ts": ["karma-typescript"]
},
sonarQubeUnitReporter : {
sonarQubeVersion: '8.x',
outputFile: 'reports/ut_report.xml',
overrideTestDescription: true,
testPath: 'app',
testFilePattern: '.spec.ts',
useBrowserName: false
},
karmaTypescriptConfig: {
bundlerOptions: {
entrypoints: /\.spec\.ts$/,
transforms: [
require("karma-typescript-angular2-transform")
]
},
compilerOptions: {
lib: ["ES2015", "DOM"]
},
reports: {
lcovonly: {
directory: 'coverage',
filename: 'lcov.info'
},
html: 'coverage'
}
},
reporters: ["progress","coverage","dots","sonarqubeUnit", "karma-typescript"],
coverageReporter: {
type: 'in-memory'
},
browsers: ["Chrome"],
singleRun: false,
plugins: [
require('karma-sonarqube-unit-reporter'),
require('karma-typescript'),
require('karma-coverage'),
require('karma-jasmine'),
require('karma-chrome-launcher')
],
});
};
0 comments:
Post a Comment