Skip to content

Commit

Permalink
chore: setup CoffeeScript coverage
Browse files Browse the repository at this point in the history
closes #143
  • Loading branch information
lucassus committed Jan 8, 2014
1 parent 683e53b commit 727b948
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 241 deletions.
14 changes: 0 additions & 14 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ module.exports = (grunt) ->

# Plugin for Karma
karma: loadMoule "karma"
# Custom plugin for generating jasmine html tests runner
jasminehtml: loadMoule "jasminehtml"

# Start a static web server
connect: loadMoule "connect"
Expand All @@ -70,7 +68,6 @@ module.exports = (grunt) ->
"less"
"copy:dev"
"ngtemplates"
"jasminehtml"
]

grunt.registerTask "server", [
Expand All @@ -97,17 +94,6 @@ module.exports = (grunt) ->
"test:unit:watch"
]

# run unit tests against compiled develepment release
# and generate code coverage report
grunt.registerTask "test:unit:coverage", [
"build:dev"
"karma:coverage"
]

grunt.registerTask "test:coverage", [
"test:unit:coverage"
]

grunt.registerTask "test", [
"karma:unit"
]
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ By default all tests are executed in PhantomJS browser
* `grunt test:unit` or `grunt test` - run unit tests
* `grunt test:unit:watch` or
* `grunt test:watch` - run unit tests in watch mode
* `grunt test:coverage` or
* `grunt test:unit:coverage` - run unit tests against compiled development release and generate code coverage report
* `grunt test:unit:coverage --coverage-reporter=html` - generate html code coverage report

* `grunt test --reporters=spec` - run tests with `spec` reporter
* `grunt test --browsers=Chrome,Firefox` - run tests inside Chrome and Firefox

Run test against specific browsers
Expand Down Expand Up @@ -157,7 +152,8 @@ And then navigate to `http://localhost:8000` to see the production release.

## File upload demo

`node_modules/blueimp-file-upload-node/server.js`
Run `node_modules/blueimp-file-upload-node/server.js`
and navigate to `http://localhost:9000/#/examples/fileUpload`

## Build and release the documentation

Expand Down
9 changes: 0 additions & 9 deletions grunt-tasks/config/coffee.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,3 @@ module.exports = (grunt) ->
dest: "<%= appConfig.dev %>/scripts"
ext: ".js"
]

test:
files: [
expand: true
cwd: "<%= appConfig.test %>"
src: "**/*.coffee"
dest: "<%= appConfig.dev %>/tests"
ext: ".js"
]
5 changes: 0 additions & 5 deletions grunt-tasks/config/jasminehtml.coffee

This file was deleted.

20 changes: 0 additions & 20 deletions grunt-tasks/config/karma.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,9 @@ module.exports = (grunt) ->
opts.default or= "PhantomJS"
_extractOptions("browsers", opts)

# Possible values: dots, spec, progress, junit, growl, coverage
parseReporters = (opts = {}) ->
opts.default or= "dots"
_extractOptions("reporters", opts)

options:
browsers: parseBrowsers(default: "PhantomJS")
colors: true
# test results reporter to use
# possible values: dots || progress || growl
reporters: parseReporters(defaultReporter: "dots")
# If browser does not capture in given timeout [ms], kill it
captureTimeout: 5000

Expand All @@ -41,17 +33,5 @@ module.exports = (grunt) ->
# run karma for unit tests in watch mode
watch:
configFile: "<%= appConfig.test %>/karma.conf.coffee"
reporters: parseReporters(default: "dots")
singleRun: false
autoWatch: true

# generate test code coverage for compiled javascripts
coverage:
basePath: "../<%= appConfig.dev %>"
configFile: "<%= appConfig.test %>/karma-coverage.conf.coffee"
reporters: ["dots", "coverage"]
coverageReporter:
type: grunt.option("coverage-reporter") || "text"
dir: "coverage"

singleRun: true
4 changes: 0 additions & 4 deletions grunt-tasks/config/watch.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ module.exports = (grunt) ->
files: ["<%= appConfig.app %>/scripts/**/*.coffee"]
tasks: ["coffee:dist", "ngtemplates"]

coffeeTest:
files: ["<%= appConfig.test %>/**/*.coffee"]
tasks: ["coffee:test", "jasminehtml"]

html:
files: [
"<%= appConfig.app %>/index.html"
Expand Down
49 changes: 0 additions & 49 deletions grunt-tasks/jasmine.html.tpl

This file was deleted.

32 changes: 0 additions & 32 deletions grunt-tasks/jasminehtml.coffee

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"karma-spec-reporter": "~0.0.1",
"karma-coffee-preprocessor": "~0.1.0",
"karma-ng-html2js-preprocessor": "~0.1.0",
"karma-coverage": "~0.1.4",
"karma-coverage": "git+https://github.com/kylewelsby/karma-coverage#fix-coffee-script-compiler",

"matchdep": "~0.3.0",
"nodemon": "~1.0.5",
Expand Down
100 changes: 0 additions & 100 deletions tests/karma-coverage.conf.coffee

This file was deleted.

16 changes: 15 additions & 1 deletion tests/karma.conf.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,26 @@ module.exports = (config) ->
]

preprocessors:
"**/*.coffee": ["coffee"]
"**/*.html": ["html2js"]

"src/scripts/**/*.coffee": ["coverage"]
"tests/unit/**/*.coffee": ["coffee"]

ngHtml2JsPreprocessor:
stripPrefix: "src/"

# html - produces a bunch of HTML files with annotated source code
# lcovonly - produces an lcov.info file
# lcov - produces html + lcov files. This is the default format
# cobertura - produces a cobertura-coverage.xml file for easy Hudson integration
# text-summary - produces a compact text summary of coverage, typically to console
# text - produces a detailed text table with coverage for all files
coverageReporter:
reporters: [
{ type: "html", dir: "coverage" }
{ type: "text-summary" }
]

reporters: ["dots", "coverage"]

# web server port
Expand Down

0 comments on commit 727b948

Please sign in to comment.