-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 #18 from spenceralger/master
Implemented code coverage
- Loading branch information
Showing
25 changed files
with
1,334 additions
and
128 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
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 |
---|---|---|
@@ -1,24 +1,41 @@ | ||
module.exports = function (grunt) { | ||
var path = require('path'); | ||
|
||
return { | ||
options: { | ||
compileDebug: false | ||
}, | ||
test: { | ||
src: [ | ||
'<%= unitTestDir %>/**/*.jade', | ||
'<%= app %>/partials/**/*.jade', | ||
'<%= app %>/apps/**/*.jade' | ||
], | ||
expand: true, | ||
ext: '.html', | ||
files: { | ||
'<%= unitTestDir %>/index.html': '<%= unitTestDir %>/index.jade' | ||
}, | ||
options: { | ||
data: function (src, dest) { | ||
var pattern = grunt.config.process('<%= unitTestDir %>/**/*.js'); | ||
var tests = grunt.file.expand({}, pattern).map(function (filename) { | ||
return filename.replace(grunt.config.get('unitTestDir'), ''); | ||
}); | ||
return { tests: JSON.stringify(tests) }; | ||
}, | ||
client: false | ||
var unitTestDir = grunt.config.get('unitTestDir'); | ||
|
||
// filter for non unit test related files | ||
if (!~path.dirname(src).indexOf(unitTestDir)) return; | ||
|
||
var pattern = unitTestDir + '/specs/**/*.js'; | ||
var appdir = grunt.config.get('app'); | ||
|
||
return { | ||
tests: grunt.file.expand({}, pattern).map(function (filename) { | ||
return path.relative(appdir, filename).replace(/\.js$/, ''); | ||
}) | ||
}; | ||
} | ||
} | ||
}, | ||
clientside: { | ||
files: { | ||
'<%= testUtilsDir %>/istanbul_reporter/report.jade.js': '<%= testUtilsDir %>/istanbul_reporter/report.clientside-jade' | ||
}, | ||
options: { | ||
client: true, | ||
amd: true, | ||
namespace: false // return the template directly in the amd wrapper | ||
} | ||
} | ||
}; | ||
}; | ||
|
||
}; |
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
module.exports = { | ||
options: { | ||
log: true, | ||
logErrors: true, | ||
run: false | ||
}, | ||
unit: { | ||
options: { | ||
log: true, | ||
logErrors: true, | ||
urls: [ | ||
'http://localhost:8001/' | ||
], | ||
run: false | ||
'http://localhost:8000/test/unit/' | ||
] | ||
} | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,23 +1,29 @@ | ||
module.exports = function (grunt) { | ||
return { | ||
test: { | ||
files: ['<%= unitTestDir %>/*.jade', '<%= unitTestDir %>/**/*.js'], | ||
tasks: ['jade:test', 'mocha:unit'] | ||
files: [ | ||
'<%= unitTestDir %>/**/*.js' | ||
], | ||
tasks: ['mocha:unit'] | ||
}, | ||
less: { | ||
files: [ | ||
'<%= app %>/**/*.less', | ||
'<%= src %>/courier/**/*.less' | ||
'<%= app %>/**/styles/**/*.less', | ||
'!<%= src %>/**/_*.less' | ||
], | ||
tasks: ['less'] | ||
}, | ||
jade: { | ||
files: [ | ||
'<%= app %>/**/*.jade', | ||
'<%= src %>/courier/**/*.jade', | ||
'!<%= unitTestDir %>/**/*.jade' | ||
'<%= unitTestDir %>/index.jade' | ||
], | ||
tasks: ['jade:test'] | ||
}, | ||
clientside_jade: { | ||
files: [ | ||
'<%= testUtilsDir %>/istanbul_reporter/report.clientside-jade' | ||
], | ||
tasks: ['jade'] | ||
tasks: ['jade:clientside'] | ||
} | ||
}; | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
module.exports = function (grunt) { | ||
grunt.registerTask('dev', ['less', 'jade', 'connect:dev', 'watch']); | ||
grunt.registerTask('dev', [ | ||
'less', | ||
'jade', | ||
'connect:dev', | ||
'watch' | ||
]); | ||
}; |
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
module.exports = function (grunt) { | ||
grunt.registerTask('server', ['connect:dev:keepalive']); | ||
grunt.registerTask('test_server', ['connect:test:keepalive']); | ||
}; |
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,26 @@ | ||
module.exports = function amdWrapMiddleware(opts) { | ||
opts = opts || {}; | ||
|
||
var root = opts.root || '/'; | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var pathPrefix = opts.pathPrefix || '/amd-wrap/'; | ||
|
||
return function (req, res, next) { | ||
// only allow prefixed requests | ||
if (req.url.substring(0, pathPrefix.length) !== pathPrefix) return next(); | ||
|
||
// strip the prefix and form the filename | ||
var filename = path.join(root, req._parsedUrl.pathname.replace('/amd-wrap/', '')); | ||
|
||
fs.readFile(filename, 'utf8', function (err, contents) { | ||
// file does not exist | ||
if (err) return next(err.code === 'ENOENT' ? void 0 : err); | ||
|
||
// respond with the wrapped code | ||
res.statusCode = 200; | ||
res.setHeader('Content-Type', 'application/javascript'); | ||
res.end('define(function (require, exports, module) {\n' + contents + '\n});'); | ||
}); | ||
}; | ||
}; |
Oops, something went wrong.