Updated the files.

This commit is contained in:
Batuhan Berk Başoğlu 2024-02-08 19:38:41 -05:00
parent 1553e6b971
commit 753967d4f5
23418 changed files with 3784666 additions and 0 deletions

View file

@ -0,0 +1,9 @@
define [], ->
# Some code under test
plus: (a, b) ->
a + b
# not covered
minus: (a, b) ->
a - b

View file

@ -0,0 +1,53 @@
module.exports = (config) ->
config.set
frameworks: ['mocha', 'requirejs']
files: [
# We do not want any files to execute automatically
{pattern: 'calculator.coffee', included: false}
{pattern: 'test.coffee', included: false}
# Except for this one. This one shall execute.
'requirejs.karma.coffee'
]
browsers: ['Firefox']
coffeePreprocessor:
options:
sourceMap: true
preprocessors:
# source files, that you wanna generate coverage for
# do not include tests or libraries
# (these files will be instrumented by Istanbul via Ibrik unless
# specified otherwise in coverageReporter.instrumenter)
'calculator.coffee': 'coverage'
# note: project files will already be converted to
# JavaScript via coverage preprocessor.
# Thus, you'll have to limit the CoffeeScript preprocessor
# to uncovered files.
'test.coffee': 'coffee'
'requirejs.karma.coffee': 'coffee'
coverageReporter:
type: 'text-summary'
useJSExtensionForCoffeeScript: true
instrumenters:
ibrik : require('ibrik')
instrumenter:
'**/*.coffee': 'ibrik'
# coverage reporter generates the coverage
reporters: ['dots', 'coverage']
plugins: [
require('../../lib/index')
'karma-mocha'
'karma-requirejs'
'karma-coffee-preprocessor'
'karma-firefox-launcher'
]
singleRun: true

View file

@ -0,0 +1,22 @@
{
"name": "karma-coverage-coffee-example",
"version": "1.0.0",
"description": "Demonstrate the usage of karma-coverage with CoffeeScript",
"main": "",
"scripts": {
"test": "./node_modules/karma/bin/karma start"
},
"author": "Lloyd Smith II <lloyd.smith@gmail.com>",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"coffee-script": "latest",
"ibrik": "^2.0.0",
"karma": "^0.13.9",
"karma-coffee-preprocessor": "latest",
"karma-firefox-launcher": "latest",
"karma-mocha": "latest",
"karma-requirejs": "^0.2.2",
"requirejs": "^2.1.20"
}
}

View file

@ -0,0 +1,6 @@
# A minimal requirejs configuration
require.config
baseUrl: '/base'
deps: ['test']
callback: ->
window.__karma__.start()

View file

@ -0,0 +1,9 @@
define ['calculator'], (calculator) ->
describe 'calculator', ->
it 'should pass', ->
true is true
it 'should work', ->
calculator.plus(1, 2) is 3