Skip to content

Commit

Permalink
fix(test): create polyfills-test.ts for karma test & setup Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
leo6104 committed May 19, 2018
1 parent be48531 commit 7fbc68c
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ package-lock.json

# e2e
/e2e/*.js
!/e2e/protractor.conf.js
/e2e/*.map

# System Files
Expand Down
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
language: node_js
node_js:
- 8
sudo: required
addons:
chrome: stable
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
install:
- npm set progress=false
- npm install
script:
- ng lint
- npm run test
- npm run e2e
- npm run build
9 changes: 4 additions & 5 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"polyfills": "src/polyfills-test.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"scripts": [],
"styles": [
"src/styles.scss"
Expand Down Expand Up @@ -97,14 +97,13 @@
}
},
"angular-electron-e2e": {
"root": "",
"sourceRoot": "",
"root": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "angular-electron:serve"
}
},
Expand Down
2 changes: 1 addition & 1 deletion protractor.conf.js → e2e/protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports.config = {
allScriptsTimeout: 25000,
delayBrowserTimeInSeconds: 0,
specs: [
'./e2e/**/*.e2e-spec.ts'
'./**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome',
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
"electron:windows": "npm run build:prod && npx electron-builder build --windows",
"electron:mac": "npm run build:prod && npx electron-builder build --mac",
"test": "ng test",
"pree2e:build": "webdriver-manager update --gecko false && npm run ng serve",
"pree2e:protractor": "wait-on http-get://localhost:4200/ && protractor ./protractor.conf.js",
"e2e": "npm-run-all -p -r pree2e:build pree2e:protractor"
"e2e": "ng e2e"
},
"dependencies": {},
"devDependencies": {
Expand All @@ -52,7 +50,7 @@
"@ngx-translate/http-loader": "3.0.1",
"@types/jasmine": "2.8.7",
"@types/jasminewd2": "2.0.3",
"@types/node": "8.0.58",
"@types/node": "~8.9.4",
"codelyzer": "4.2.1",
"core-js": "2.5.6",
"cross-env": "5.1.5",
Expand All @@ -68,7 +66,7 @@
"karma-coverage-istanbul-reporter": "2.0.0",
"karma-jasmine": "1.1.2",
"karma-jasmine-html-reporter": "1.1.0",
"npm-run-all": "4.1.3",
"npm-run-all": "^4.1.3",
"npx": "10.2.0",
"protractor": "5.3.2",
"replace": "0.3.0",
Expand Down
18 changes: 2 additions & 16 deletions karma.conf.js → src/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,12 @@ module.exports = function (config) {
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
files: [

],
preprocessors: {

},
mime: {
'text/x-typescript': ['ts','tsx']
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'),
dir: require('path').join(__dirname, '../coverage'),
reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
: ['progress', 'kjhtml'],
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
Expand Down
3 changes: 3 additions & 0 deletions src/polyfills-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';

2 changes: 1 addition & 1 deletion src/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"types": []
},
"exclude": [
"test.ts",
"src/test.ts",
"**/*.spec.ts",
"dist",
"app-builds",
Expand Down
4 changes: 1 addition & 3 deletions src/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
"compilerOptions": {
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "es5",
"baseUrl": "",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts",
"polyfills.ts"
"polyfills-test.ts"
],
"include": [
"**/*.spec.ts",
Expand Down

0 comments on commit 7fbc68c

Please sign in to comment.