Commit 6fbb260d authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

WIP: tests integration with CI

parent aacafe0b
...@@ -29,6 +29,7 @@ out-tsc ...@@ -29,6 +29,7 @@ out-tsc
/e2e/*.js /e2e/*.js
/e2e/*.map /e2e/*.map
/typings /typings
/coverage
#--- OTHER ---# #--- OTHER ---#
......
# UID := $(id -u) UID := $(id -u)
# GID := $(id -g) GID := $(id -g)
UID := 1000 # UID := 1000
GID := 1000 # GID := 1000
list: list:
@echo "" @echo ""
...@@ -39,11 +39,12 @@ stop: ...@@ -39,11 +39,12 @@ stop:
restart: stop start restart: stop start
test: test:
rm -rf ./coverage
@docker build -t anis-node conf-dev && docker run --init -it --rm --user $(UID):$(GID) \ @docker build -t anis-node conf-dev && docker run --init -it --rm --user $(UID):$(GID) \
--name anis-client \ --name anis-client \
-p 9876:9876 \ -p 9876:9876 \
-v $(CURDIR):/project -d \ -v $(CURDIR):/project -d \
-w /project anis-node ng test -w /project anis-node ng test --code-coverage
ng-build: ng-build:
@docker build -t anis-node conf-dev && docker run --init -it --rm --user $(UID):$(GID) \ @docker build -t anis-node conf-dev && docker run --init -it --rm --user $(UID):$(GID) \
......
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
"polyfills": "src/polyfills.ts", "polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json", "tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js", "karmaConfig": "karma.conf.js",
"codeCoverage": true,
"assets": [ "assets": [
"src/favicon.ico", "src/favicon.ico",
"src/assets" "src/assets"
......
...@@ -2,32 +2,37 @@ ...@@ -2,32 +2,37 @@
// https://karma-runner.github.io/1.0/config/configuration-file.html // https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) { module.exports = function (config) {
config.set({ config.set({
basePath: '', basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'], frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [ plugins: [
require('karma-jasmine'), require('karma-jasmine'),
require('karma-chrome-launcher'), require('karma-chrome-launcher'),
require('karma-firefox-launcher'), require('karma-jasmine-html-reporter'),
require('karma-jasmine-html-reporter'), require('karma-coverage-istanbul-reporter'),
require('karma-coverage-istanbul-reporter'), require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma') ],
], client: {
client: { clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false // leave Jasmine Spec Runner output visible in browser },
}, coverageIstanbulReporter: {
coverageIstanbulReporter: { dir: require('path').join(__dirname, './coverage'),
// dir: require('path').join(__dirname, './coverage/anis-client'), reports: ['html', 'lcovonly', 'text-summary'],
reports: ['html', 'lcovonly', 'text-summary'], fixWebpackSourcePaths: true
fixWebpackSourcePaths: true },
}, reporters: ['progress', 'kjhtml'],
reporters: ['progress', 'kjhtml'], port: 9876,
port: 9876, colors: true,
colors: true, logLevel: config.LOG_INFO,
logLevel: config.LOG_INFO, autoWatch: true,
autoWatch: true, browsers: ['ChromeHeadlessCI'],
browsers: ['Firefox'], customLaunchers: {
singleRun: false, ChromeHeadlessCI: {
restartOnFileChange: true base: 'ChromeHeadless',
}); flags: ['--no-sandbox'],
}
},
singleRun: true,
restartOnFileChange: true
});
}; };
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HomeComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
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