doutan8775 2016-08-07 16:16
浏览 41
已采纳

银杏不提供Travis CI的承保范围

I have a GO project which I build in Travis CI. I have implemented a few tests with Ginkgo, and I am getting code coverage when I run it locally, however I get no coverage when I run it on Travis.

My .travis.yml

language: go

# safelist
branches:
  only:
  - master
  - travis

before_install:
  - go get github.com/onsi/gomega
  - go get github.com/onsi/ginkgo/ginkgo
  - go get github.com/modocache/gover

script:
  - ginkgo -r --randomizeAllSpecs --randomizeSuites --failOnPending --cover --trace --race --compilers=2

after_success:
  - gover . coverage.txt
  - ls -al
  - cat coverage.txt
  - bash <(curl -s https://codecov.io/bash)

When I run the script command on my own machine I get the following result

$ ginkgo -r --randomizeAllSpecs --randomizeSuites --failOnPending --cover --trace --race --compilers=2
Running Suite: Gitserver Suite
==============================
Random Seed: 1470431018 - Will randomize all specs
Will run 4 of 4 specs

++++
Ran 4 of 4 Specs in 0.000 seconds
SUCCESS! -- 4 Passed | 0 Failed | 0 Pending | 0 Skipped PASS
coverage: 25.9% of statements

Ginkgo ran 1 suite in 4.411023s
Test Suite Passed

But on travis CI the coverage says "0.0% of statement"

I have tried to setup a new GOPATH on my local machine to get a clean setup and only run the commands that occurs in the Travis log, and I still get a reported 25% coverage. My machine is running windows where as Travis is linux, that is the only difference I can think of right now.

I have just tried GoCover.io on my package, and that also gives me the 25% coverage that I get locally.

  • 写回答

2条回答 默认 最新

  • dongtui6347 2016-08-11 18:06
    关注

    I finally got it to work after I ran the travis build locally through their docker image. For some reason I need to specify which package to cover, so the ginkgo command has been changed into

    ginkgo -r --randomizeAllSpecs --randomizeSuites --failOnPending --coverpkg gitserver --trace --race --compilers=2
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度