Angular 20, oa. migrating from Karma to Vitest
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
2026-01-21 11:25:38 +01:00
parent b72e309fbe
commit 3c6a8e28c1
33 changed files with 1785 additions and 3315 deletions

View File

@@ -133,39 +133,10 @@
} }
}, },
"test": { "test": {
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular/build:unit-test",
"options": { "options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json", "tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js", "browsers": ["chromium"]
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
}
}
},
"farmmaps-lib-app-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "farmmaps-lib-app:serve"
},
"configurations": {
"production": {
"devServerTarget": "farmmaps-lib-app:serve:production"
}
} }
} }
} }
@@ -189,11 +160,10 @@
} }
}, },
"test": { "test": {
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular/build:unit-test",
"options": { "options": {
"main": "projects/common/src/test.ts",
"tsConfig": "projects/common/tsconfig.spec.json", "tsConfig": "projects/common/tsconfig.spec.json",
"karmaConfig": "projects/common/karma.conf.js" "browsers": ["chromium"]
} }
} }
} }
@@ -217,11 +187,10 @@
} }
}, },
"test": { "test": {
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular/build:unit-test",
"options": { "options": {
"main": "projects/common-map/src/test.ts",
"tsConfig": "projects/common-map/tsconfig.spec.json", "tsConfig": "projects/common-map/tsconfig.spec.json",
"karmaConfig": "projects/common-map/karma.conf.js" "browsers": ["chromium"]
} }
} }
} }
@@ -245,11 +214,10 @@
} }
}, },
"test": { "test": {
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular/build:unit-test",
"options": { "options": {
"main": "projects/common-map3d/src/test.ts",
"tsConfig": "projects/common-map3d/tsconfig.spec.json", "tsConfig": "projects/common-map3d/tsconfig.spec.json",
"karmaConfig": "projects/common-map3d/karma.conf.js" "browsers": ["chromium"]
} }
} }
} }
@@ -273,11 +241,10 @@
} }
}, },
"test": { "test": {
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular/build:unit-test",
"options": { "options": {
"main": "projects/ng-openlayers/src/test.ts",
"tsConfig": "projects/ng-openlayers/tsconfig.spec.json", "tsConfig": "projects/ng-openlayers/tsconfig.spec.json",
"karmaConfig": "projects/ng-openlayers/karma.conf.js" "browsers": ["chromium"]
} }
}, },
"lint": { "lint": {

View File

@@ -1,28 +0,0 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};

View File

@@ -1,23 +0,0 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('Welcome to farmmaps-lib-app!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});

View File

@@ -1,11 +0,0 @@
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get(browser.baseUrl) as Promise<any>;
}
getTitleText() {
return element(by.css('app-root h1')).getText() as Promise<string>;
}
}

View File

@@ -1,13 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}

3565
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,7 @@
"@farmmaps/common-map": "file:dist/common-map", "@farmmaps/common-map": "file:dist/common-map",
"@farmmaps/common-map3d": "file:dist/common-map3d", "@farmmaps/common-map3d": "file:dist/common-map3d",
"@farmmaps/ng-openlayers": "file:dist/ng-openlayers", "@farmmaps/ng-openlayers": "file:dist/ng-openlayers",
"@microsoft/signalr": "^3.1.16", "@microsoft/signalr": "10.0.0",
"@ng-bootstrap/ng-bootstrap": "^19.0.0", "@ng-bootstrap/ng-bootstrap": "^19.0.0",
"@ngrx/effects": "20.1.0", "@ngrx/effects": "20.1.0",
"@ngrx/router-store": "20.1.0", "@ngrx/router-store": "20.1.0",
@@ -63,32 +63,29 @@
"devDependencies": { "devDependencies": {
"@angular-builders/custom-webpack": "20.0.0", "@angular-builders/custom-webpack": "20.0.0",
"@angular-devkit/build-angular": "20.3.14", "@angular-devkit/build-angular": "20.3.14",
"@angular/build": "20.3.14",
"@angular/cli": "20.3.14", "@angular/cli": "20.3.14",
"@angular/compiler-cli": "20.3.16", "@angular/compiler-cli": "20.3.16",
"@angular/language-service": "20.3.16", "@angular/language-service": "20.3.16",
"@angular/localize": "20.3.16", "@angular/localize": "20.3.16",
"@types/arcgis-rest-api": "^10.4.5", "@types/arcgis-rest-api": "^10.4.5",
"@types/jasmine": "~2.8.8", "@types/jasmine": "^5.1.15",
"@types/jasminewd2": "^2.0.9",
"@types/node": "^22.5.4", "@types/node": "^22.5.4",
"@typescript-eslint/eslint-plugin": "^6.18.0", "@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/eslint-plugin-tslint": "^6.18.0", "@typescript-eslint/eslint-plugin-tslint": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0", "@typescript-eslint/parser": "^6.18.0",
"@vitest/browser": "^4.0.17",
"@vitest/browser-playwright": "^4.0.17",
"codelyzer": "^6.0.2", "codelyzer": "^6.0.2",
"eslint": "^8.35.0", "eslint": "^8.35.0",
"eslint-config-prettier": "^8.6.0", "eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.27.5", "eslint-plugin-import": "^2.27.5",
"jasmine-core": "^4.3.0", "jasmine-core": "^6.0.1",
"jasmine-spec-reporter": "^7.0.0", "jsdom": "^27.4.0",
"karma": "^6.3.20", "ng-packagr": "20.3.2",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-jasmine": "^5.1.0",
"karma-jasmine-html-reporter": "^2.0.0",
"ng-packagr": "^20.3.2",
"protractor": "~7.0.0",
"ts-node": "^8.8.1", "ts-node": "^8.8.1",
"typescript": "~5.8.3" "typescript": "~5.8.3",
"vitest": "^4.0.17"
}, },
"overrides": { "overrides": {
"ngrx-store-localstorage": { "ngrx-store-localstorage": {
@@ -96,4 +93,4 @@
"@angular/core": "$@angular/core" "@angular/core": "$@angular/core"
} }
} }
} }

View File

@@ -1,18 +0,0 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'core-js/es7/reflect';
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
);

View File

@@ -31,7 +31,6 @@
"compilationMode": "partial" "compilationMode": "partial"
}, },
"exclude": [ "exclude": [
"src/test.ts",
"**/*.spec.ts" "**/*.spec.ts"
] ]
} }

View File

@@ -31,7 +31,6 @@
"compilationMode": "partial" "compilationMode": "partial"
}, },
"exclude": [ "exclude": [
"src/test.ts",
"**/*.spec.ts" "**/*.spec.ts"
] ]
} }

View File

@@ -3,12 +3,10 @@
"compilerOptions": { "compilerOptions": {
"outDir": "../../out-tsc/spec", "outDir": "../../out-tsc/spec",
"types": [ "types": [
"jasmine",
"node" "node"
] ]
}, },
"files": [ "files": [
"src/test.ts"
], ],
"include": [ "include": [
"**/*.spec.ts", "**/*.spec.ts",

View File

@@ -1,32 +0,0 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/common-map3d'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

View File

@@ -11,8 +11,8 @@
"tslib": "^2.0.0" "tslib": "^2.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/common": "^18.2.3", "@angular/common": "20.3.16",
"@angular/core": "^18.2.3", "@angular/core": "20.3.16",
"cesium": "^1.97.0", "cesium": "^1.97.0",
"ol-cesium": ">=2.13.0" "ol-cesium": ">=2.13.0"
} }
@@ -34,35 +34,46 @@
"extraneous": true "extraneous": true
}, },
"node_modules/@angular/common": { "node_modules/@angular/common": {
"version": "18.2.3", "version": "20.3.16",
"resolved": "https://registry.npmjs.org/@angular/common/-/common-18.2.3.tgz", "resolved": "https://registry.npmjs.org/@angular/common/-/common-20.3.16.tgz",
"integrity": "sha512-NFL4yXXImSCH7i1xnHykUjHa9vl9827fGiwSV2mnf7LjSUsyDzFD8/54dNuYN9OY8AUD+PnK0YdNro6cczVyIA==", "integrity": "sha512-GRAziNlntwdnJy3F+8zCOvDdy7id0gITjDnM6P9+n2lXvtDuBLGJKU3DWBbvxcCjtD6JK/g/rEX5fbCxbUHkQQ==",
"license": "MIT",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"tslib": "^2.3.0" "tslib": "^2.3.0"
}, },
"engines": { "engines": {
"node": "^18.19.1 || ^20.11.1 || >=22.0.0" "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/core": "18.2.3", "@angular/core": "20.3.16",
"rxjs": "^6.5.3 || ^7.4.0" "rxjs": "^6.5.3 || ^7.4.0"
} }
}, },
"node_modules/@angular/core": { "node_modules/@angular/core": {
"version": "18.2.3", "version": "20.3.16",
"resolved": "https://registry.npmjs.org/@angular/core/-/core-18.2.3.tgz", "resolved": "https://registry.npmjs.org/@angular/core/-/core-20.3.16.tgz",
"integrity": "sha512-VGhMJxj7d0rYpqVfQrcGRB7EE/BCziotft/I/YPl6bOMPSAvMukG7DXQuJdYpNrr62ks78mlzHlZX/cdmB9Prw==", "integrity": "sha512-KSFPKvOmWWLCJBbEO+CuRUXfecX2FRuO0jNi9c54ptXMOPHlK1lIojUnyXmMNzjdHgRug8ci9qDuftvC2B7MKg==",
"license": "MIT",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"tslib": "^2.3.0" "tslib": "^2.3.0"
}, },
"engines": { "engines": {
"node": "^18.19.1 || ^20.11.1 || >=22.0.0" "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/compiler": "20.3.16",
"rxjs": "^6.5.3 || ^7.4.0", "rxjs": "^6.5.3 || ^7.4.0",
"zone.js": "~0.14.10" "zone.js": "~0.15.0"
},
"peerDependenciesMeta": {
"@angular/compiler": {
"optional": true
},
"zone.js": {
"optional": true
}
} }
}, },
"node_modules/@cesium/engine": { "node_modules/@cesium/engine": {
@@ -498,9 +509,10 @@
} }
}, },
"node_modules/rxjs": { "node_modules/rxjs": {
"version": "7.8.1", "version": "7.8.2",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
"integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
"license": "Apache-2.0",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"tslib": "^2.1.0" "tslib": "^2.1.0"
@@ -549,12 +561,6 @@
"integrity": "sha512-Dn6vJ1Z9v1tepSjvnCpwk5QqwIPcEFKdgnjqfYOABv1ngSofuAhtlugcUC3ehS1OHdgDWSG6C5mvj+Qm15udTQ==", "integrity": "sha512-Dn6vJ1Z9v1tepSjvnCpwk5QqwIPcEFKdgnjqfYOABv1ngSofuAhtlugcUC3ehS1OHdgDWSG6C5mvj+Qm15udTQ==",
"peer": true "peer": true
}, },
"node_modules/zone.js": {
"version": "0.14.10",
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.14.10.tgz",
"integrity": "sha512-YGAhaO7J5ywOXW6InXNlLmfU194F8lVgu7bRntUF3TiG8Y3nBK0x1UJJuHUP/e8IyihkjCYqhCScpSwnlaSRkQ==",
"peer": true
},
"node_modules/zstddec": { "node_modules/zstddec": {
"version": "0.1.0", "version": "0.1.0",
"resolved": "https://registry.npmjs.org/zstddec/-/zstddec-0.1.0.tgz", "resolved": "https://registry.npmjs.org/zstddec/-/zstddec-0.1.0.tgz",

View File

@@ -1,17 +0,0 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
);

View File

@@ -32,7 +32,6 @@
"compilationMode": "partial" "compilationMode": "partial"
}, },
"exclude": [ "exclude": [
"src/test.ts",
"**/*.spec.ts" "**/*.spec.ts"
] ]
} }

View File

@@ -32,7 +32,6 @@
"compilationMode": "partial" "compilationMode": "partial"
}, },
"exclude": [ "exclude": [
"src/test.ts",
"**/*.spec.ts" "**/*.spec.ts"
] ]
} }

View File

@@ -3,12 +3,10 @@
"compilerOptions": { "compilerOptions": {
"outDir": "../../out-tsc/spec", "outDir": "../../out-tsc/spec",
"types": [ "types": [
"jasmine",
"node" "node"
] ]
}, },
"files": [ "files": [
"src/test.ts"
], ],
"include": [ "include": [
"**/*.spec.ts", "**/*.spec.ts",

View File

@@ -1,32 +0,0 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/common'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

File diff suppressed because it is too large Load Diff

View File

@@ -14,7 +14,7 @@
"@ngrx/store": "20.1.0", "@ngrx/store": "20.1.0",
"tassign": "^1.0.0", "tassign": "^1.0.0",
"bootstrap": "^5.3.3", "bootstrap": "^5.3.3",
"@microsoft/signalr": "^3.1.16", "@microsoft/signalr": "10.0.0",
"ngx-uploadx": "7.0.1", "ngx-uploadx": "7.0.1",
"angular-oauth2-oidc": "^17.0.2", "angular-oauth2-oidc": "^17.0.2",
"moment": "^2.29.4", "moment": "^2.29.4",

View File

@@ -1,18 +0,0 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'core-js/es7/reflect';
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
);

View File

@@ -31,7 +31,6 @@
"compilationMode": "partial" "compilationMode": "partial"
}, },
"exclude": [ "exclude": [
"src/test.ts",
"**/*.spec.ts" "**/*.spec.ts"
] ]
} }

View File

@@ -31,7 +31,6 @@
"compilationMode": "partial" "compilationMode": "partial"
}, },
"exclude": [ "exclude": [
"src/test.ts",
"**/*.spec.ts" "**/*.spec.ts"
] ]
} }

View File

@@ -3,12 +3,10 @@
"compilerOptions": { "compilerOptions": {
"outDir": "../../out-tsc/spec", "outDir": "../../out-tsc/spec",
"types": [ "types": [
"jasmine",
"node" "node"
] ]
}, },
"files": [ "files": [
"src/test.ts"
], ],
"include": [ "include": [
"**/*.spec.ts", "**/*.spec.ts",

View File

@@ -1,32 +0,0 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/ng-openlayers'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true,
});
};

View File

@@ -18,11 +18,10 @@
} }
}, },
"test": { "test": {
"executor": "@angular-devkit/build-angular:karma", "executor": "@angular/build:unit-test",
"options": { "options": {
"main": "libs/ng-openlayers/src/test.ts",
"tsConfig": "libs/ng-openlayers/tsconfig.spec.json", "tsConfig": "libs/ng-openlayers/tsconfig.spec.json",
"karmaConfig": "libs/ng-openlayers/karma.conf.js" "browsers": ["chromium"]
} }
}, },
"lint": { "lint": {

View File

@@ -1,12 +0,0 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'core-js/es7/reflect';
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false },
});

View File

@@ -31,7 +31,6 @@
"compilationMode": "partial" "compilationMode": "partial"
}, },
"exclude": [ "exclude": [
"src/test.ts",
"**/*.spec.ts" "**/*.spec.ts"
] ]
} }

View File

@@ -31,7 +31,6 @@
"compilationMode": "partial" "compilationMode": "partial"
}, },
"exclude": [ "exclude": [
"src/test.ts",
"**/*.spec.ts" "**/*.spec.ts"
] ]
} }

View File

@@ -3,12 +3,10 @@
"compilerOptions": { "compilerOptions": {
"outDir": "../../dist/out-tsc", "outDir": "../../dist/out-tsc",
"types": [ "types": [
"jasmine",
"node" "node"
] ]
}, },
"files": [ "files": [
"src/test.ts"
], ],
"include": [ "include": [
"**/*.spec.ts", "**/*.spec.ts",

View File

@@ -1,32 +0,0 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage/farmmaps-lib-app'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

View File

@@ -1,16 +0,0 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
);

View File

@@ -3,12 +3,10 @@
"compilerOptions": { "compilerOptions": {
"outDir": "../out-tsc/spec", "outDir": "../out-tsc/spec",
"types": [ "types": [
"jasmine",
"node" "node"
] ]
}, },
"files": [ "files": [
"test.ts",
"polyfills.ts" "polyfills.ts"
], ],
"include": [ "include": [