Skip to content

Commit 7fbc68c

Browse files
committed
fix(test): create polyfills-test.ts for karma test & setup Travis CI
1 parent be48531 commit 7fbc68c

9 files changed

+25
-31
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ package-lock.json
3838

3939
# e2e
4040
/e2e/*.js
41+
!/e2e/protractor.conf.js
4142
/e2e/*.map
4243

4344
# System Files

.travis.yml

+9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
language: node_js
22
node_js:
33
- 8
4+
sudo: required
5+
addons:
6+
chrome: stable
7+
before_script:
8+
- export DISPLAY=:99.0
9+
- sh -e /etc/init.d/xvfb start
410
install:
511
- npm set progress=false
612
- npm install
713
script:
14+
- ng lint
15+
- npm run test
16+
- npm run e2e
817
- npm run build

angular.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@
6565
"builder": "@angular-devkit/build-angular:karma",
6666
"options": {
6767
"main": "src/test.ts",
68-
"karmaConfig": "./karma.conf.js",
69-
"polyfills": "src/polyfills.ts",
68+
"polyfills": "src/polyfills-test.ts",
7069
"tsConfig": "src/tsconfig.spec.json",
70+
"karmaConfig": "src/karma.conf.js",
7171
"scripts": [],
7272
"styles": [
7373
"src/styles.scss"
@@ -97,14 +97,13 @@
9797
}
9898
},
9999
"angular-electron-e2e": {
100-
"root": "",
101-
"sourceRoot": "",
100+
"root": "e2e",
102101
"projectType": "application",
103102
"architect": {
104103
"e2e": {
105104
"builder": "@angular-devkit/build-angular:protractor",
106105
"options": {
107-
"protractorConfig": "./protractor.conf.js",
106+
"protractorConfig": "e2e/protractor.conf.js",
108107
"devServerTarget": "angular-electron:serve"
109108
}
110109
},

protractor.conf.js renamed to e2e/protractor.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exports.config = {
77
allScriptsTimeout: 25000,
88
delayBrowserTimeInSeconds: 0,
99
specs: [
10-
'./e2e/**/*.e2e-spec.ts'
10+
'./**/*.e2e-spec.ts'
1111
],
1212
capabilities: {
1313
'browserName': 'chrome',

package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
"electron:windows": "npm run build:prod && npx electron-builder build --windows",
3131
"electron:mac": "npm run build:prod && npx electron-builder build --mac",
3232
"test": "ng test",
33-
"pree2e:build": "webdriver-manager update --gecko false && npm run ng serve",
34-
"pree2e:protractor": "wait-on http-get://localhost:4200/ && protractor ./protractor.conf.js",
35-
"e2e": "npm-run-all -p -r pree2e:build pree2e:protractor"
33+
"e2e": "ng e2e"
3634
},
3735
"dependencies": {},
3836
"devDependencies": {
@@ -52,7 +50,7 @@
5250
"@ngx-translate/http-loader": "3.0.1",
5351
"@types/jasmine": "2.8.7",
5452
"@types/jasminewd2": "2.0.3",
55-
"@types/node": "8.0.58",
53+
"@types/node": "~8.9.4",
5654
"codelyzer": "4.2.1",
5755
"core-js": "2.5.6",
5856
"cross-env": "5.1.5",
@@ -68,7 +66,7 @@
6866
"karma-coverage-istanbul-reporter": "2.0.0",
6967
"karma-jasmine": "1.1.2",
7068
"karma-jasmine-html-reporter": "1.1.0",
71-
"npm-run-all": "4.1.3",
69+
"npm-run-all": "^4.1.3",
7270
"npx": "10.2.0",
7371
"protractor": "5.3.2",
7472
"replace": "0.3.0",

karma.conf.js renamed to src/karma.conf.js

+2-16
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,12 @@ module.exports = function (config) {
1515
client:{
1616
clearContext: false // leave Jasmine Spec Runner output visible in browser
1717
},
18-
files: [
19-
20-
],
21-
preprocessors: {
22-
23-
},
24-
mime: {
25-
'text/x-typescript': ['ts','tsx']
26-
},
2718
coverageIstanbulReporter: {
28-
dir: require('path').join(__dirname, 'coverage'),
19+
dir: require('path').join(__dirname, '../coverage'),
2920
reports: [ 'html', 'lcovonly' ],
3021
fixWebpackSourcePaths: true
3122
},
32-
angularCli: {
33-
environment: 'dev'
34-
},
35-
reporters: config.angularCli && config.angularCli.codeCoverage
36-
? ['progress', 'coverage-istanbul']
37-
: ['progress', 'kjhtml'],
23+
reporters: ['progress', 'kjhtml'],
3824
port: 9876,
3925
colors: true,
4026
logLevel: config.LOG_INFO,

src/polyfills-test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import 'core-js/es7/reflect';
2+
import 'zone.js/dist/zone';
3+

src/tsconfig.app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"types": []
88
},
99
"exclude": [
10-
"test.ts",
10+
"src/test.ts",
1111
"**/*.spec.ts",
1212
"dist",
1313
"app-builds",

src/tsconfig.spec.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
"compilerOptions": {
44
"outDir": "../out-tsc/spec",
55
"module": "commonjs",
6-
"target": "es5",
7-
"baseUrl": "",
86
"types": [
97
"jasmine",
108
"node"
119
]
1210
},
1311
"files": [
1412
"test.ts",
15-
"polyfills.ts"
13+
"polyfills-test.ts"
1614
],
1715
"include": [
1816
"**/*.spec.ts",

0 commit comments

Comments
 (0)