Skip to content

Commit 11af4f5

Browse files
Added Unit testing with Karma and Jasmine
1 parent 2e8978a commit 11af4f5

File tree

6 files changed

+1288
-197
lines changed

6 files changed

+1288
-197
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ language: node_js
44
node_js:
55
- 10.8
66
addons:
7+
chrome: stable
78
sonarcloud:
89
organization: "gautamkrishnar-github"
910
token:
@@ -29,5 +30,6 @@ cache:
2930

3031
script:
3132
- sonar-scanner || true # Ignore sonar-scanner
33+
- npm run unit-test-ci
3234
- npm run test
3335
- kill $(jobs -p) || true

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Visit [db_server](https://github.com/gautamkrishnar/nothing-private/tree/master/
5353
* [MySQL Database](https://www.mysql.com/)
5454
* [JSON](https://www.json.org/)
5555
* [HTML](https://developer.mozilla.org/es/docs/Web/HTML) & [CSS](https://developer.mozilla.org/es/docs/Web/CSS)
56+
* [Karma](https://karma-runner.github.io/) and [Jasmine](https://jasmine.github.io/) for unit testing
57+
* [Cypress](https://www.cypress.io/) for integration testing
5658

5759
## Contributing
5860

karma.conf.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Karma configuration
2+
// Generated on Sun Dec 22 2019 17:53:52 GMT+0530 (India Standard Time)
3+
module.exports = function (config) {
4+
config.set({
5+
6+
// base path that will be used to resolve all patterns (eg. files, exclude)
7+
basePath: '',
8+
9+
10+
// frameworks to use
11+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
12+
frameworks: ['jasmine'],
13+
14+
// list of files / patterns to load in the browser
15+
files: [
16+
'tests/main.spec.js',
17+
'main.js',
18+
],
19+
20+
21+
// test results reporter to use
22+
// possible values: 'dots', 'progress'
23+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
24+
reporters: ['progress'],
25+
26+
27+
// web server port
28+
port: 9876,
29+
30+
31+
// enable / disable colors in the output (reporters and logs)
32+
colors: true,
33+
34+
35+
// level of logging
36+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
37+
logLevel: config.LOG_INFO,
38+
39+
40+
// enable / disable watching file and executing tests whenever any file changes
41+
autoWatch: true,
42+
43+
44+
// start these browsers
45+
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
46+
browsers: ['Chrome'],
47+
48+
// If browser does not capture in given timeout [ms], kill it
49+
captureTimeout: 60000,
50+
51+
// Continuous Integration mode
52+
// if true, Karma captures browsers, runs the tests and exits
53+
singleRun: false,
54+
});
55+
};

0 commit comments

Comments
 (0)