Merge branch 'coffeescript-coverage' into 'master'

Add JavaScript coverage analysis

## What does this MR do?

- configure teaspoon to calculate test coverage of JavaScript files
- publish result as GitLab pages

## Why was this MR needed?

- test coverage was not calculated for JavaScript files
- JavaScript wants to be under cover 🕶️ 

## What are the relevant issue numbers?

#19412 

See merge request !5052
This commit is contained in:
Robert Speicher 2016-08-09 19:50:24 +00:00
commit 37013c6de0
3 changed files with 15 additions and 4 deletions

1
.gitignore vendored
View file

@ -30,6 +30,7 @@
/config/secrets.yml /config/secrets.yml
/config/sidekiq.yml /config/sidekiq.yml
/coverage/* /coverage/*
/coverage-javascript/
/db/*.sqlite3 /db/*.sqlite3
/db/*.sqlite3-journal /db/*.sqlite3-journal
/db/data.yml /db/data.yml

View file

@ -222,7 +222,15 @@ teaspoon:
stage: test stage: test
<<: *use-db <<: *use-db
script: script:
- curl --silent --location https://deb.nodesource.com/setup_6.x | bash -
- apt-get install --assume-yes nodejs
- npm install --global istanbul
- teaspoon - teaspoon
artifacts:
name: coverage-javascript
expire_in: 31d
paths:
- coverage-javascript/default/
bundler:audit: bundler:audit:
stage: test stage: test
@ -269,10 +277,12 @@ pages:
stage: pages stage: pages
dependencies: dependencies:
- coverage - coverage
- teaspoon
script: script:
- mv public/ .public/ - mv public/ .public/
- mkdir public/ - mkdir public/
- mv coverage public/coverage-ruby - mv coverage public/coverage-ruby
- mv coverage-javascript/default/ public/coverage-javascript/
artifacts: artifacts:
paths: paths:
- public - public

View file

@ -149,7 +149,7 @@ Teaspoon.configure do |config|
# Specify that you always want a coverage configuration to be used. Otherwise, specify that you want coverage # Specify that you always want a coverage configuration to be used. Otherwise, specify that you want coverage
# on the CLI. # on the CLI.
# Set this to "true" or the name of your coverage config. # Set this to "true" or the name of your coverage config.
# config.use_coverage = nil config.use_coverage = true
# You can have multiple coverage configs by passing a name to config.coverage. # You can have multiple coverage configs by passing a name to config.coverage.
# e.g. config.coverage :ci do |coverage| # e.g. config.coverage :ci do |coverage|
@ -158,15 +158,15 @@ Teaspoon.configure do |config|
# Which coverage reports Istanbul should generate. Correlates directly to what Istanbul supports. # Which coverage reports Istanbul should generate. Correlates directly to what Istanbul supports.
# #
# Available: text-summary, text, html, lcov, lcovonly, cobertura, teamcity # Available: text-summary, text, html, lcov, lcovonly, cobertura, teamcity
# coverage.reports = ["text-summary", "html"] coverage.reports = ["text-summary", "html"]
# The path that the coverage should be written to - when there's an artifact to write to disk. # The path that the coverage should be written to - when there's an artifact to write to disk.
# Note: Relative to `config.root`. # Note: Relative to `config.root`.
# coverage.output_path = "coverage" coverage.output_path = "coverage-javascript"
# Assets to be ignored when generating coverage reports. Accepts an array of filenames or regular expressions. The # Assets to be ignored when generating coverage reports. Accepts an array of filenames or regular expressions. The
# default excludes assets from vendor, gems and support libraries. # default excludes assets from vendor, gems and support libraries.
# coverage.ignore = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}] coverage.ignore = [%r{vendor/}, %r{spec/}]
# Various thresholds requirements can be defined, and those thresholds will be checked at the end of a run. If any # Various thresholds requirements can be defined, and those thresholds will be checked at the end of a run. If any
# aren't met the run will fail with a message. Thresholds can be defined as a percentage (0-100), or nil. # aren't met the run will fail with a message. Thresholds can be defined as a percentage (0-100), or nil.