Is it possible to set up travis to run tests for several languages?

前端 未结 3 1382
心在旅途
心在旅途 2020-12-23 21:25

I have a rails project and am running tests for my JavaScript test (Jasmine) through Karma

.travis.yml file

language: ruby
rvm:
  - 2.0.0
script:
  -         


        
3条回答
  •  执念已碎
    2020-12-23 22:13

    K-Yo's answer got me moving in the right direction, but far short of success. Here is what I needed:

    First in my .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
    

    Then I also placed this code in my package.json, though I'm not sure if it was needed:

    "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"
    },
    

    Finally, I learned that Travis is case sensitive, so:

    'bower_components/jquery/dist/jquery.min.js',
    

    in my karma.conf.js needed to be:

    'bower_components/jQuery/dist/jquery.min.js',
    

提交回复
热议问题