Skip to content
This repository was archived by the owner on Mar 25, 2023. It is now read-only.

Commit 3044e1f

Browse files
authored
Merge pull request #234 from bwsw/angular-cli
Angular CLI integration
2 parents 0e1acda + ae045d6 commit 3044e1f

File tree

73 files changed

+564
-871
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+564
-871
lines changed

.angular-cli.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"project": {
4+
"name": "cloudstack-ui"
5+
},
6+
"apps": [
7+
{
8+
"root": "src",
9+
"outDir": "dist",
10+
"assets": [
11+
"config",
12+
"i18n",
13+
"css",
14+
"img"
15+
],
16+
"index": "index.html",
17+
"main": "main.ts",
18+
"polyfills": "polyfills.ts",
19+
"test": "test.ts",
20+
"tsconfig": "tsconfig.app.json",
21+
"testTsconfig": "tsconfig.spec.json",
22+
"prefix": "cs",
23+
"styles": [
24+
"style/app.scss"
25+
],
26+
"scripts": [],
27+
"environmentSource": "environments/environment.ts",
28+
"environments": {
29+
"dev": "environments/environment.ts",
30+
"prod": "environments/environment.prod.ts"
31+
}
32+
}
33+
],
34+
"e2e": {
35+
"protractor": {
36+
"config": "./protractor.conf.js"
37+
}
38+
},
39+
"lint": [
40+
{
41+
"project": "src/tsconfig.app.json"
42+
},
43+
{
44+
"project": "src/tsconfig.spec.json"
45+
},
46+
{
47+
"project": "e2e/tsconfig.e2e.json"
48+
}
49+
],
50+
"test": {
51+
"karma": {
52+
"config": "./karma.conf.js"
53+
}
54+
},
55+
"defaults": {
56+
"styleExt": "scss",
57+
"component": {}
58+
}
59+
}

e2e/app.e2e-spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { CloudstackUiPage } from './app.po';
2+
3+
describe('cloudstack-ui App', () => {
4+
let page: CloudstackUiPage;
5+
6+
beforeEach(() => {
7+
page = new CloudstackUiPage();
8+
});
9+
10+
it('should display welcome message', () => {
11+
page.navigateTo();
12+
expect(page.getParagraphText()).toEqual('Welcome to app!!');
13+
});
14+
});

e2e/app.po.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { browser, by, element } from 'protractor';
2+
3+
export class CloudstackUiPage {
4+
navigateTo() {
5+
return browser.get('/');
6+
}
7+
8+
getParagraphText() {
9+
return element(by.css('app-root h1')).getText();
10+
}
11+
}

e2e/tsconfig.e2e.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../out-tsc/e2e",
5+
"module": "commonjs",
6+
"target": "es5",
7+
"types": [
8+
"jasmine",
9+
"node"
10+
]
11+
}
12+
}

karma-shim.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

karma.conf.js

Lines changed: 36 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,47 @@
1-
var path = require('path');
2-
3-
var webpackConfig = require('./webpack.config');
4-
5-
var ENV = process.env.npm_lifecycle_event;
6-
var isTestWatch = ENV === 'test-watch';
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/0.13/config/configuration-file.html
73

84
module.exports = function (config) {
9-
var _config = {
10-
11-
// base path that will be used to resolve all patterns (eg. files, exclude)
5+
config.set({
126
basePath: '',
13-
14-
// frameworks to use
15-
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
16-
frameworks: ['jasmine'],
17-
18-
// list of files / patterns to load in the browser
19-
files: [
20-
{ pattern: './karma-shim.js', watched: false }
7+
frameworks: ['jasmine', '@angular/cli'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-junit-reporter'),
12+
require('karma-mocha-reporter'),
13+
require('karma-jasmine-html-reporter'),
14+
require('karma-coverage-istanbul-reporter'),
15+
require('@angular/cli/plugins/karma')
2116
],
22-
23-
// list of files to exclude
24-
exclude: [],
25-
26-
// preprocess matching files before serving them to the browser
27-
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
28-
preprocessors: {
29-
'./karma-shim.js': ['webpack', 'sourcemap']
17+
client: {
18+
clearContext: false // leave Jasmine Spec Runner output visible in browser
3019
},
31-
32-
webpack: webpackConfig,
33-
34-
webpackMiddleware: {
35-
// webpack-dev-middleware configuration
36-
// i. e.
37-
stats: 'errors-only'
20+
coverageIstanbulReporter: {
21+
dir: 'reports/coverage',
22+
'report-config': {
23+
cobertura: {
24+
file: 'cobertura/cobertura.xml'
25+
}
26+
},
27+
reports: ['html', 'lcovonly', 'cobertura'],
28+
fixWebpackSourcePaths: true
3829
},
39-
40-
webpackServer: {
41-
noInfo: true // please don't spam the console when running in karma!
30+
angularCli: {
31+
environment: 'dev'
4232
},
43-
44-
// test results reporter to use
45-
// possible values: 'dots', 'progress', 'mocha'
46-
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
47-
reporters: ['mocha'],
48-
49-
// web server port
33+
reporters: ['mocha', 'junit', 'kjhtml', 'coverage-istanbul'],
5034
port: 9876,
51-
52-
// enable / disable colors in the output (reporters and logs)
35+
junitReporter: {
36+
outputDir: 'reports', // results will be saved as $outputDir/$browserName.xml
37+
outputFile: 'junit.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile
38+
suite: '', // suite will become the package name attribute in xml testsuite element
39+
useBrowserName: false // add browser name to report and classes names
40+
},
5341
colors: true,
54-
55-
// level of logging
56-
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
5742
logLevel: config.LOG_INFO,
58-
59-
// enable / disable watching file and executing tests whenever any file changes
60-
autoWatch: false,
61-
62-
// start these browsers
63-
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
64-
browsers: isTestWatch ? ['Chrome'] : ['ChromeHeadless'],
65-
43+
autoWatch: true,
44+
browsers: ['ChromeHeadless'],
6645
customLaunchers: {
6746
ChromeHeadless: {
6847
base: 'Chrome',
@@ -74,40 +53,6 @@ module.exports = function (config) {
7453
]
7554
}
7655
},
77-
78-
// Continuous Integration mode
79-
// if true, Karma captures browsers, runs the tests and exits
80-
singleRun: true
81-
};
82-
83-
if (!isTestWatch) {
84-
_config.reporters.push('coverage');
85-
_config.reporters.push('junit');
86-
87-
_config.junitReporter = {
88-
outputDir: 'reports', // results will be saved as $outputDir/$browserName.xml
89-
outputFile: 'junit.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile
90-
suite: '', // suite will become the package name attribute in xml testsuite element
91-
useBrowserName: false // add browser name to report and classes names
92-
};
93-
94-
_config.coverageReporter = {
95-
dir: 'reports/',
96-
reporters: [
97-
{
98-
type: 'json',
99-
subdir: 'coverage/json',
100-
file: 'coverage-final.json'
101-
},
102-
{
103-
type: 'cobertura',
104-
subdir: 'coverage/cobertura',
105-
file: 'cobertura.xml'
106-
}
107-
]
108-
};
109-
}
110-
111-
config.set(_config);
112-
56+
singleRun: false
57+
});
11358
};

0 commit comments

Comments
 (0)