K-Yo 的回答让我朝着正确的方向前进,但远未成功。这是我需要的:
首先在我的 .travis.yml 中:
language: ruby
rvm:
- 2.1.1
before_script:
- psql -c 'create database spokenvote_test;' -U postgres
- cp config/database.travis.yml config/database.yml
- rake db:test_prep
- npm install karma
- npm install karma-jasmine
- npm install karma-coverage
- npm install karma-phantomjs-launcher
- npm install karma-coffee-preprocessor
script:
- bundle exec rspec spec # basic for ruby
- node_modules/karma/bin/karma start config/karma.conf.js --single-run --browsers PhantomJS
然后我还将这段代码放在了我的 package.json 中,虽然我不确定是否需要它:
"devDependencies": {
"karma": "~0.12",
"karma-jasmine": "~0.2",
"karma-coverage": "~0.2.6",
"karma-phantomjs-launcher": "~0.1.4",
"karma-coffee-preprocessor": "~0.2.1"
},
最后,我了解到 Travis 是区分大小写的,所以:
'bower_components/jquery/dist/jquery.min.js',
在我的 karma.conf.js 中需要:
'bower_components/jQuery/dist/jquery.min.js',