-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from juriejan/better-filename-matching
Better filename matching
- Loading branch information
Showing
29 changed files
with
522 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/*global module*/ | ||
module.exports = function(grunt) { | ||
|
||
"use strict"; | ||
|
||
grunt.initConfig({ | ||
|
||
blanket_mocha : { | ||
test: { | ||
src: ['test.html'], | ||
options : { | ||
threshold : 60, | ||
globalThreshold : 65, | ||
log : true, | ||
logErrors: true, | ||
moduleThreshold : 60, | ||
modulePattern : "./src/(.*?)/", | ||
customThreshold: { | ||
'./src/spelling/plurals.js': 50 | ||
} | ||
} | ||
} | ||
|
||
} | ||
}); | ||
|
||
// Loading dependencies | ||
for (var key in grunt.file.readJSON("package.json").devDependencies) { | ||
if (key !== "grunt" && key.indexOf("grunt") === 0) { | ||
grunt.loadNpmTasks(key); | ||
} | ||
} | ||
|
||
grunt.registerTask('coverage', ['blanket_mocha']); | ||
grunt.registerTask('default', ['blanket_mocha']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Demo | ||
|
||
1. First, `cd` to the `examples` directory (this directory) | ||
2. Next, run `npm install` | ||
3. Run `grunt` | ||
4. You should see some tests run, and a coverage report which will demonstrate a failure at the "per-module" level. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
"use strict"; | ||
|
||
define([ | ||
|
||
], function( | ||
) { | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "grunt-blanket-mocha-test", | ||
"description": "Test for grunt-blanket-mocha.", | ||
"version": "0.5.1", | ||
"homepage": "https://github.com/ModelN/grunt-blanket-mocha", | ||
"author": { | ||
"name": "Dave Cadwallader", | ||
"email": "[email protected]" | ||
}, | ||
"main": "Gruntfile.js", | ||
"engines": { | ||
"node": ">= 0.8.0" | ||
}, | ||
"devDependencies": { | ||
"grunt-blanket-mocha": "~0.4.0", | ||
"grunt": "0.4.1", | ||
"mocha": "1.17.1", | ||
"chai": "1.8.1", | ||
"blanket": "1.1.5", | ||
"requirejs": "2.1.10" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
define([ | ||
|
||
], function(){ | ||
|
||
var addThree = function(addTo) { | ||
return addTo + 3; | ||
}; | ||
|
||
var addFive = function(addTo) { | ||
return addTo + 5; | ||
}; | ||
|
||
var addSeven = function(addTo) { | ||
return addTo + 7; | ||
}; | ||
|
||
return { | ||
addThree: addThree, | ||
addFive: addFive, | ||
addSeven: addSeven | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
define([ | ||
|
||
], function(){ | ||
|
||
var subtractThree = function(subtractFrom) { | ||
return subtractFrom - 3; | ||
}; | ||
|
||
var subtractFive = function(subtractFrom) { | ||
return subtractFrom - 5; | ||
}; | ||
|
||
var subtractSeven = function(subtractFrom) { | ||
return subtractFrom - 7; | ||
}; | ||
|
||
return { | ||
subtractThree: subtractThree, | ||
subtractFive: subtractFive, | ||
subtractSeven: subtractSeven | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
define([ | ||
|
||
], function(){ | ||
|
||
var dog = function(howMany) { | ||
var ret; | ||
if (howMany < 0) { | ||
ret = "0 dogs"; | ||
} else if (howMany === 1) { | ||
ret = "1 dog"; | ||
} else { | ||
ret = "" + howMany + " dogs"; | ||
} | ||
|
||
return ret; | ||
}; | ||
|
||
var cat = function(howMany) { | ||
var ret; | ||
if (howMany < 0) { | ||
ret = "0 cats"; | ||
} else if (howMany === 1) { | ||
ret = "1 cat"; | ||
} else { | ||
ret = "" + howMany + " cats"; | ||
} | ||
|
||
return ret; | ||
}; | ||
|
||
var fish = function(howMany) { | ||
return "" + howMany + " fish"; | ||
}; | ||
|
||
return { | ||
cat: cat, | ||
fish: fish | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
define([ | ||
|
||
], function(){ | ||
|
||
var isVowel = function ( theLetter ) { | ||
|
||
if ( !theLetter ) { | ||
return false; | ||
} else if ( theLetter.length > 1 ) { | ||
return false; | ||
} | ||
|
||
theLetter = theLetter.toUpperCase(); | ||
|
||
switch(theLetter) { | ||
case "A": | ||
case "E": | ||
case "I": | ||
case "O": | ||
case "U": | ||
return true; | ||
default: | ||
return false; | ||
} | ||
|
||
}; | ||
|
||
var isNotVowel = function(theLetter) { | ||
|
||
var isAVowel = isVowel(theLetter); | ||
|
||
return ! isAVowel; | ||
}; | ||
|
||
return { | ||
isVowel: isVowel | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Mocha Tests</title> | ||
<link rel="stylesheet" href="node_modules/mocha/mocha.css" /> | ||
|
||
<script src="node_modules/mocha/mocha.js"></script> | ||
<script src="node_modules/requirejs/require.js"></script> | ||
|
||
<script type="text/javascript" src="node_modules/blanket/dist/qunit/blanket.js" | ||
data-cover-flags="branchTracking" | ||
data-cover-only="//src/"></script> | ||
|
||
<script type="text/javascript" src="node_modules/grunt-blanket-mocha/support/mocha-blanket.js"></script> | ||
|
||
<script> | ||
mocha.setup('bdd'); | ||
|
||
if (window.PHANTOMJS) { | ||
blanket.options("reporter", "node_modules/grunt-blanket-mocha/support/grunt-reporter.js" | ||
); | ||
} | ||
|
||
//load main js first, this will load all the | ||
//script dependencies | ||
require(["main"], function(main) { | ||
require(["test/test-loader"], function(TestLoader) { | ||
//start running the mocha tests | ||
TestLoader.start(); | ||
}); | ||
}); | ||
|
||
</script> | ||
</head> | ||
<body> | ||
<div id="mocha"></div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
define([ | ||
"src/math/addition" | ||
], function( | ||
Math | ||
){ | ||
|
||
describe("Addition test", function() { | ||
|
||
it("should add five to positive numbers", function() { | ||
expect(Math.addFive(2)).to.equal(7); | ||
}); | ||
|
||
it("should add seven to positive numbers", function() { | ||
expect(Math.addSeven(2)).to.equal(9); | ||
}); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
define([ | ||
"src/math/subtraction" | ||
], function( | ||
Math | ||
){ | ||
|
||
describe("Subtraction test", function() { | ||
|
||
it("should subtract five from positive numbers", function() { | ||
expect(Math.subtractFive(8)).to.equal(3); | ||
}); | ||
|
||
}); | ||
|
||
}); |
Oops, something went wrong.