Skip to content

Commit b558371

Browse files
committed
Update karma config and add TravisCI configuration for it
1 parent 7567186 commit b558371

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
language: node_js
2+
env: TRAVISCI=true
23
node_js:
3-
- 0.8
4+
- "0.10"
5+
- "0.8"
6+
before_script:
7+
- export DISPLAY=:99.0
8+
- sh -e /etc/init.d/xvfb start

README.md

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,27 +99,13 @@ Tests for CamanJS run both in NodeJS and the browser.
9999

100100
### NodeJS
101101

102-
The NodeJS tests use mocha as the test runner. The simplest way to run the test suite is:
103-
104-
```
105-
npm test
106-
```
102+
The NodeJS tests use mocha as the test runner. The simplest way to run the test suite is by running `npm test`.
107103

108104
### Browser
109105

110-
The browser tests are run by Karma. It will start up Chrome, Firefox, and Safari in the background. If you're running Windows, you will want to remove Safari by editing `test/karma.conf.js`. You can minimize each of these browsers if desired. It will automatically run tests after CamanJS is recompiled by the Cakefile as well.
106+
The browser tests are run by Karma. It will start up Chrome, Firefox, and Safari (if running OSX) in the background. You can minimize each of these browsers if desired. It will automatically run tests after CamanJS is recompiled by the Cakefile as well.
111107

112-
**Because it prefers to be installed globally, Karma is a soft dependency.**
113-
114-
**Install**
115-
```
116-
npm install -g karma
117-
```
118-
119-
**Run**
120-
```
121-
karma start test/karma.conf.js
122-
```
108+
You can run Karma by running `karma start`, or you can do a single run with the NodeJS tests by running `npm test`.
123109

124110
## Project Contributors
125111

test/karma.conf.js renamed to karma.conf.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
// base path, that will be used to resolve files and exclude
10-
basePath = '..';
10+
basePath = '.';
1111

1212
frameworks = ['jasmine'];
1313

@@ -60,7 +60,15 @@ autoWatch = true;
6060
// - PhantomJS
6161
// - IE (only Windows)
6262
// CLI --browsers Chrome,Firefox,Safari
63-
browsers = ['Chrome', 'Firefox', 'Safari'];
63+
browsers = ['Firefox'];
64+
65+
if (!process.env.TRAVISCI) {
66+
browsers.push('Chrome')
67+
68+
if (require('os').platform() === 'darwin') {
69+
browsers.push('Safari')
70+
}
71+
}
6472

6573
// If browser does not capture in given timeout [ms], kill it
6674
// CLI --capture-timeout 5000

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@
5353
"chai": "*",
5454
"servedir": "*",
5555
"cli": "*",
56-
"cli-table": "*"
56+
"cli-table": "*",
57+
"karma": "*"
5758
},
5859
"scripts": {
59-
"test": "./node_modules/mocha/bin/mocha --compilers coffee:coffee-script --reporter spec --globals Caman ./test/unit/*.coffee",
60+
"test": "./node_modules/mocha/bin/mocha --compilers coffee:coffee-script --reporter spec --globals Caman ./test/unit/*.coffee && ./node_modules/.bin/karma start --single-run",
6061
"examples": "./node_modules/servedir/bin/servedir",
6162
"docs": "codo",
6263
"docs-server": "codo --server"

0 commit comments

Comments
 (0)