Comparing version 1.6.2 to 1.7.0
@@ -5,3 +5,4 @@ 'use strict' | ||
check = require('../check'), | ||
async = require('async') | ||
async = require('async'), | ||
stringify = require('../stringify') | ||
@@ -74,7 +75,7 @@ /** | ||
'\x1b[1;32mInput:\x1b[0m\n' + | ||
JSON.stringify(post, null, ' ') + '\n' + | ||
stringify(post, true) + '\n' + | ||
'\x1b[1;32mOutput:\x1b[0m\n' + | ||
JSON.stringify(out, null, ' ') + '\n' + | ||
stringify(out, true) + '\n' + | ||
'\x1b[1;32mExpected:\x1b[0m\n' + | ||
JSON.stringify(expected, null, ' ') + '\n' + | ||
stringify(expected, true) + '\n' + | ||
'-----\n') | ||
@@ -81,0 +82,0 @@ throw e |
'use strict' | ||
var stringify = require('../stringify') | ||
/** | ||
@@ -32,5 +34,5 @@ * @class | ||
'\x1b[1;32mDocuments in ' + that.collection + ':\x1b[0m\n' + | ||
JSON.stringify(docs, null, ' ') + '\n' + | ||
stringify(docs, true) + '\n' + | ||
'\x1b[1;32mFind query:\x1b[0m\n' + | ||
JSON.stringify(selector, null, ' ') + '\n' + | ||
stringify(selector, true) + '\n' + | ||
'-----\n') | ||
@@ -37,0 +39,0 @@ return done(new Error('No document like ' + JSON.stringify(selector) + ' found in ' + that.collection)) |
@@ -21,3 +21,4 @@ /*globals describe, before, it*/ | ||
* @param {Object} [options.context] | ||
* @param {function(Array<Header|Obj>)} [options.preParse] | ||
* @param {function(string):boolean} [options.filterFile] | ||
* @param {function(Array<Header|Obj>, Test)} [options.preParse] | ||
* @param {Function} [options.describe] | ||
@@ -38,2 +39,5 @@ * @param {Function} [options.before] | ||
options.strict = options.strict === undefined ? true : options.strict | ||
options.filterFile = options.filterFile || function () { | ||
return true | ||
} | ||
options.preParse = options.preParse || function () {} | ||
@@ -55,3 +59,3 @@ | ||
walk(options.recursive, folder, function (file) { | ||
if (file.substr(-3) === '.md') { | ||
if (file.substr(-3) === '.md' && options.filterFile(file)) { | ||
parse(fs.readFileSync(file, 'utf8'), options.preParse).execute(options) | ||
@@ -58,0 +62,0 @@ } |
{ | ||
"name": "api-test", | ||
"version": "1.6.2", | ||
"version": "1.7.0", | ||
"author": "Sitegui <sitegui@sitegui.com.br>", | ||
@@ -5,0 +5,0 @@ "description": "API testing made simple", |
@@ -22,3 +22,3 @@ /** | ||
* @param {string} text | ||
* @param {function(Array<Header|Obj>)} preParse | ||
* @param {function(Array<Header|Obj>, Test)} preParse | ||
* @returns {Test} | ||
@@ -58,3 +58,3 @@ * @throws if the syntax is invalid | ||
try { | ||
preParse(els) | ||
preParse(els, test) | ||
i = parseHeader(test, els, 0) | ||
@@ -61,0 +61,0 @@ i = parseSetups(test, els, i) |
@@ -149,2 +149,3 @@ # API Test | ||
* `strict`: (optional) whether the output check should be strict and complain about unexpected keys (default: true) | ||
* `filterFile`: (optional) a function that will be called for every file and should return true if this file should be parsed | ||
* `preParse`: (optional) a function that will be called with all pre-parsed tokens (Header and Obj). This lets you do crazy stuff with the parsing if you want | ||
@@ -151,0 +152,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59932
30
1767
211