Skip to content

Commit

Permalink
chore: add support for automated testing for travis processes
Browse files Browse the repository at this point in the history
  • Loading branch information
rajey committed May 8, 2019
1 parent 22dc481 commit 1cb227a
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ exclude_paths:
- 'src/assets/'
- 'src/typings.d.ts'
- 'src/app/**/*.spec.ts'
- 'src/karma.conf.js'
- 'src/polyfills.ts'
- 'src/test.ts'
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ install:
- npm install

script:
- npm run test:travis
- npm run e2e:travis
- npm run build

notifications:
Expand Down
26 changes: 7 additions & 19 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,17 @@
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
],
"codeCoverage": true,
"styles": ["src/styles.css"],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
]
"assets": ["src/favicon.ico", "src/assets", "src/manifest.json"]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
"exclude": ["**/node_modules/**"]
}
}
}
Expand All @@ -121,9 +111,7 @@
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
"exclude": ["**/node_modules/**"]
}
}
}
Expand All @@ -133,4 +121,4 @@
"cli": {
"defaultCollection": "@ngrx/schematics"
}
}
}
10 changes: 10 additions & 0 deletions e2e/protractor-ci.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const config = require('./protractor.conf').config;

config.capabilities = {
browserName: 'chrome',
chromeOptions: {
args: ['--headless', '--no-sandbox']
}
};

exports.config = config;
4 changes: 2 additions & 2 deletions e2e/src/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ describe('workspace-project App', () => {
page = new AppPage();
});

it('should display welcome message', () => {
it('should start the application', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to ngx-seed-app!');
expect(page).toBeTruthy();
});
});
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
"start": "ng serve",
"build": "ng build --prod --aot && cd dist/ngx-seed-app && zip -r -D ngx-seed-app.zip .",
"test": "ng test",
"test:travis": "ng test -- --no-watch --no-progress --code-coverage --browsers=ChromeHeadlessCI",
"lint": "ng lint",
"e2e": "ng e2e",
"e2e:travis": "ng e2e -- --protractor-config=e2e/protractor-ci.conf.js",
"compodoc": "./node_modules/.bin/compodoc -p src/tsconfig.app.json",
"serve-docs": "./node_modules/.bin/compodoc -s -d documentation"
},
Expand Down
10 changes: 8 additions & 2 deletions src/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
Expand All @@ -26,6 +26,12 @@ module.exports = function (config) {
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
singleRun: false
});
};
};

0 comments on commit 1cb227a

Please sign in to comment.