mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Add Istanbul for code coverage, parameter tests for 100% coverage.
This commit is contained in:
parent
285a30e124
commit
77da8da9cf
3 changed files with 39 additions and 0 deletions
|
@ -52,6 +52,7 @@ function lintFile(file, config, callback) {
|
|||
|
||||
module.exports = function markdownlint(options, callback) {
|
||||
options = options || {};
|
||||
callback = callback || function noop() {};
|
||||
var files = options.files || [];
|
||||
var config = options.config || { "default": true };
|
||||
var results = {};
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"test": "nodeunit",
|
||||
"test-cover": "istanbul cover node_modules/nodeunit/bin/nodeunit",
|
||||
"debug": "node debug node_modules/nodeunit/bin/nodeunit",
|
||||
"lint": "eslint lib test"
|
||||
},
|
||||
|
@ -23,6 +24,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^0.15.0",
|
||||
"istanbul": "^0.3.7",
|
||||
"nodeunit": "^0.9.0",
|
||||
"q": "^1.2.0"
|
||||
},
|
||||
|
|
|
@ -66,3 +66,39 @@ fs.readdirSync(__dirname).forEach(function forFile(file) {
|
|||
module.exports[file] = createTestForFile(path.join(__dirname, file));
|
||||
}
|
||||
});
|
||||
|
||||
module.exports.missingOptions = function missingOptions(test) {
|
||||
test.expect(2);
|
||||
markdownlint(null, function callback(err, result) {
|
||||
test.ifError(err);
|
||||
test.ok(result, "Did not get result for missing options.");
|
||||
test.done();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.missingFiles = function missingFiles(test) {
|
||||
test.expect(2);
|
||||
markdownlint({}, function callback(err, result) {
|
||||
test.ifError(err);
|
||||
test.ok(result, "Did not get result for missing files.");
|
||||
test.done();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.missingCallback = function missingCallback(test) {
|
||||
test.expect(0);
|
||||
markdownlint();
|
||||
test.done();
|
||||
};
|
||||
|
||||
module.exports.badFile = function badFile(test) {
|
||||
test.expect(3);
|
||||
markdownlint({
|
||||
"files": [ "./badFile" ]
|
||||
}, function callback(err, result) {
|
||||
test.ok(err, "Did not get an error for bad file.");
|
||||
test.equal(err.code, "ENOENT", "Error code for bad file not ENOENT.");
|
||||
test.ok(!result, "Got result for bad file.");
|
||||
test.done();
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue