Skip to content

Commit bf76a82

Browse files
author
Łukasz Gałka
committed
add tests
1 parent c1245d1 commit bf76a82

27 files changed

+2105
-226
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,8 @@ Desktop.ini
3131
# Build files
3232
dist/*
3333

34+
# Coverage
35+
coverage/*
36+
3437
# Playground tmp files
3538
.playground

init-test-bed.spec.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"use strict";
2+
exports.__esModule = true;
3+
require("reflect-metadata");
4+
require("zone.js/dist/zone.js");
5+
require("zone.js/dist/proxy.js");
6+
require("zone.js/dist/sync-test.js");
7+
require("zone.js/dist/jasmine-patch.js");
8+
require("zone.js/dist/async-test.js");
9+
require("zone.js/dist/fake-async-test.js");
10+
var testing_1 = require("@angular/core/testing");
11+
var testing_2 = require("@angular/platform-browser-dynamic/testing");
12+
testing_1.TestBed.initTestEnvironment(testing_2.BrowserDynamicTestingModule, testing_2.platformBrowserDynamicTesting());

init-test-bed.spec.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import 'reflect-metadata'
2+
import 'zone.js/dist/zone.js'
3+
import 'zone.js/dist/proxy.js'
4+
import 'zone.js/dist/sync-test.js'
5+
import 'zone.js/dist/jasmine-patch.js'
6+
import 'zone.js/dist/async-test.js'
7+
import 'zone.js/dist/fake-async-test.js'
8+
import { TestBed } from '@angular/core/testing'
9+
import {
10+
BrowserDynamicTestingModule,
11+
platformBrowserDynamicTesting
12+
} from '@angular/platform-browser-dynamic/testing'
13+
14+
TestBed.initTestEnvironment(
15+
BrowserDynamicTestingModule,
16+
platformBrowserDynamicTesting()
17+
)

karma.conf.js

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Karma configuration
2+
// Generated on Wed Oct 11 2017 18:56:07 GMT+0200 (Central European Daylight Time)
3+
4+
module.exports = function(config) {
5+
config.set({
6+
7+
// base path that will be used to resolve all patterns (eg. files, exclude)
8+
basePath: '',
9+
10+
11+
// frameworks to use
12+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13+
frameworks: ['jasmine', 'karma-typescript'],
14+
15+
16+
// list of files / patterns to load in the browser
17+
files: [
18+
'init-test-bed.spec.ts',
19+
'src/**/*.ts'
20+
],
21+
22+
23+
// list of files to exclude
24+
exclude: [
25+
],
26+
27+
28+
// preprocess matching files before serving them to the browser
29+
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
30+
preprocessors: {
31+
'**/*.ts': ['karma-typescript']
32+
},
33+
34+
karmaTypescriptConfig: {
35+
bundlerOptions: {
36+
entrypoints: /\.spec\.ts$/,
37+
transforms: [
38+
require('karma-typescript-angular2-transform')
39+
]
40+
},
41+
compilerOptions: {
42+
lib: ['ES2015', 'DOM']
43+
}
44+
},
45+
46+
// test results reporter to use
47+
// possible values: 'dots', 'progress'
48+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
49+
reporters: ['progress', 'karma-typescript'],
50+
51+
52+
// web server port
53+
port: 9876,
54+
55+
56+
// enable / disable colors in the output (reporters and logs)
57+
colors: true,
58+
59+
60+
// level of logging
61+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
62+
logLevel: config.LOG_INFO,
63+
64+
65+
// enable / disable watching file and executing tests whenever any file changes
66+
autoWatch: true,
67+
68+
69+
// start these browsers
70+
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
71+
browsers: ['Chrome'],
72+
73+
74+
// Continuous Integration mode
75+
// if true, Karma captures browsers, runs the tests and exits
76+
singleRun: false,
77+
78+
// Concurrency level
79+
// how many browser should be started simultaneous
80+
concurrency: Infinity
81+
})
82+
}

0 commit comments

Comments
 (0)