Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "acquit", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Parse BDD tests (Mocha, Jasmine) to generate documentation", | ||
@@ -31,5 +31,5 @@ "homepage": "http://acquit.mongoosejs.io", | ||
"devDependencies": { | ||
"acquit-ignore": "0.0.5", | ||
"acquit-ignore": "0.1.0", | ||
"acquit-markdown": "0.1.0", | ||
"acquit-require": "0.0.4", | ||
"acquit-require": "0.1.1", | ||
"highlight.js": "9.12.0", | ||
@@ -36,0 +36,0 @@ "marked": "0.4.0", |
139
README.md
@@ -23,19 +23,20 @@ # acquit | ||
```javascript | ||
var contents = | ||
'/**\n' + | ||
' * A `Model` is a convenience wrapper around objects stored in a\n' + | ||
' * collection\n' + | ||
' */\n' + | ||
'describe(\'Model\', function() {\n' + | ||
' /**\n' + | ||
' * Model **should** be able to save stuff\n' + | ||
' **/\n' + | ||
' it(\'can save\', function() {\n' + | ||
' assert.ok(1);\n' + | ||
' });\n' + | ||
'\n' + | ||
' it(\'can save with a parameter\', function() {\n' + | ||
' });\n' + | ||
'});'; | ||
var contents = ` | ||
/** | ||
* A Model is a convenience wrapper around objects stored in a | ||
* collection | ||
*/ | ||
describe('Model', function() { | ||
/** | ||
* Model **should** be able to save | ||
**/ | ||
it('can save', function() { | ||
assert.ok(1); | ||
}); | ||
it('can save with a parameter', function() { | ||
}); | ||
}); | ||
`; | ||
var ret = acquit.parse(contents); | ||
@@ -47,3 +48,3 @@ | ||
assert.equal(1, ret[0].comments.length); | ||
assert.ok(ret[0].comments[0].indexOf('`Model`') != -1); | ||
assert.ok(ret[0].comments[0].indexOf('Model') != -1); | ||
@@ -71,9 +72,10 @@ // Top-level block contains the `it('can save')` block, which contains | ||
```javascript | ||
var contents = | ||
'describe(\'ES6\', function() {\n' + | ||
' // ES6 has a `yield` keyword\n' + | ||
' it(\'should be able to yield\', function() {\n' + | ||
' // some code\n' + | ||
' });\n' + | ||
'});'; | ||
var contents = ` | ||
describe('ES6', function() { | ||
// ES6 has a yield keyword | ||
it(\'should be able to yield\', function() { | ||
// some code | ||
}); | ||
}); | ||
`; | ||
@@ -101,9 +103,10 @@ var cb = function(block) { | ||
```javascript | ||
var contents = | ||
'describe(\'ES6\', function() {\n' + | ||
' // ES6 has a `yield` keyword\n' + | ||
' it(\'should be able to yield\', function() {\n' + | ||
' // some code\n' + | ||
' });\n' + | ||
'});'; | ||
var contents = ` | ||
describe('ES6', function() { | ||
// ES6 has a yield keyword | ||
it('should be able to yield', function() { | ||
// some code | ||
}); | ||
}); | ||
`; | ||
@@ -129,11 +132,12 @@ var cb = function(block) { | ||
```javascript | ||
var contents = | ||
'describe(\'ES6\', function() {\n' + | ||
' // ES6 has a `yield` keyword\n' + | ||
' it(\'should be able to yield\', function() {\n' + | ||
' co(function*() {\n' + | ||
' yield 1;\n' + | ||
' })();\n' + | ||
' });\n' + | ||
'});'; | ||
var contents = ` | ||
describe('ES6', function() { | ||
// ES6 has a yield keyword | ||
it('should be able to yield', function() { | ||
co(function*() { | ||
yield 1; | ||
})(); | ||
}); | ||
}); | ||
`; | ||
@@ -160,8 +164,9 @@ var ret = acquit.parse(contents); | ||
```javascript | ||
var contents = | ||
'context(\'Mocha aliases\', function() {\n' + | ||
' specify(\'should be parsed\', function() {\n' + | ||
' assert.equal(1, 1);\n' + | ||
' });\n' + | ||
'});'; | ||
var contents = ` | ||
context('Mocha aliases', function() { | ||
specify('should be parsed', function() { | ||
assert.equal(1, 1); | ||
}); | ||
}); | ||
`; | ||
@@ -188,4 +193,4 @@ var ret = acquit.parse(contents); | ||
```javascript | ||
var str = ' * This comment looks like a \n' + | ||
' * parsed JSdoc-style comment'; | ||
var str = ` * This comment looks like a | ||
* parsed JSdoc-style comment`; | ||
@@ -203,4 +208,4 @@ assert.equal(acquit.trimEachLine(str), 'This comment looks like a\n' + | ||
```javascript | ||
var str = 'This comment looks like a \n' + | ||
' * parsed JSdoc-style comment'; | ||
var str = `This comment looks like a | ||
* parsed JSdoc-style comment`; | ||
@@ -221,16 +226,16 @@ assert.equal(acquit.trimEachLine(str), 'This comment looks like a\n' + | ||
```javascript | ||
var contents = [ | ||
'describe("My feature", function() {', | ||
' it("works", function() {', | ||
' // some code', | ||
' });', | ||
'});' | ||
].join('\n'); | ||
var contents = ` | ||
describe("My feature", function() { | ||
it("works", function() { | ||
// some code | ||
}); | ||
}); | ||
`; | ||
acquit.output(function(res) { | ||
return [ | ||
'# ' + res[0].contents, | ||
'\n', | ||
'## ' + res[0].blocks[0].contents | ||
].join('\n'); | ||
return ` | ||
# ${res[0].contents} | ||
## ${res[0].blocks[0].contents} | ||
`; | ||
}); | ||
@@ -240,7 +245,7 @@ | ||
assert.equal(res, [ | ||
'# My feature', | ||
'\n', | ||
'## works' | ||
].join('\n')); | ||
assert.equal(res.trim(), ` | ||
# My feature | ||
## works | ||
`.trim()); | ||
acquit.removeAllTransforms(); | ||
@@ -247,0 +252,0 @@ ``` |
@@ -12,19 +12,20 @@ var assert = require('assert'); | ||
it('can parse Mocha tests into `blocks`', function() { | ||
var contents = | ||
'/**\n' + | ||
' * A `Model` is a convenience wrapper around objects stored in a\n' + | ||
' * collection\n' + | ||
' */\n' + | ||
'describe(\'Model\', function() {\n' + | ||
' /**\n' + | ||
' * Model **should** be able to save stuff\n' + | ||
' **/\n' + | ||
' it(\'can save\', function() {\n' + | ||
' assert.ok(1);\n' + | ||
' });\n' + | ||
'\n' + | ||
' it(\'can save with a parameter\', function() {\n' + | ||
' });\n' + | ||
'});'; | ||
var contents = ` | ||
/** | ||
* A Model is a convenience wrapper around objects stored in a | ||
* collection | ||
*/ | ||
describe('Model', function() { | ||
/** | ||
* Model **should** be able to save | ||
**/ | ||
it('can save', function() { | ||
assert.ok(1); | ||
}); | ||
it('can save with a parameter', function() { | ||
}); | ||
}); | ||
`; | ||
var ret = acquit.parse(contents); | ||
@@ -36,3 +37,3 @@ | ||
assert.equal(1, ret[0].comments.length); | ||
assert.ok(ret[0].comments[0].indexOf('`Model`') != -1); | ||
assert.ok(ret[0].comments[0].indexOf('Model') != -1); | ||
@@ -57,9 +58,10 @@ // Top-level block contains the `it('can save')` block, which contains | ||
it('can call user function on `code` block and save return value', function() { | ||
var contents = | ||
'describe(\'ES6\', function() {\n' + | ||
' // ES6 has a `yield` keyword\n' + | ||
' it(\'should be able to yield\', function() {\n' + | ||
' // some code\n' + | ||
' });\n' + | ||
'});'; | ||
var contents = ` | ||
describe('ES6', function() { | ||
// ES6 has a yield keyword | ||
it(\'should be able to yield\', function() { | ||
// some code | ||
}); | ||
}); | ||
`; | ||
@@ -84,9 +86,10 @@ var cb = function(block) { | ||
it('can define transforms', function() { | ||
var contents = | ||
'describe(\'ES6\', function() {\n' + | ||
' // ES6 has a `yield` keyword\n' + | ||
' it(\'should be able to yield\', function() {\n' + | ||
' // some code\n' + | ||
' });\n' + | ||
'});'; | ||
var contents = ` | ||
describe('ES6', function() { | ||
// ES6 has a yield keyword | ||
it('should be able to yield', function() { | ||
// some code | ||
}); | ||
}); | ||
`; | ||
@@ -109,11 +112,12 @@ var cb = function(block) { | ||
it('can parse the ES6 `yield` keyword', function() { | ||
var contents = | ||
'describe(\'ES6\', function() {\n' + | ||
' // ES6 has a `yield` keyword\n' + | ||
' it(\'should be able to yield\', function() {\n' + | ||
' co(function*() {\n' + | ||
' yield 1;\n' + | ||
' })();\n' + | ||
' });\n' + | ||
'});'; | ||
var contents = ` | ||
describe('ES6', function() { | ||
// ES6 has a yield keyword | ||
it('should be able to yield', function() { | ||
co(function*() { | ||
yield 1; | ||
})(); | ||
}); | ||
}); | ||
`; | ||
@@ -137,8 +141,9 @@ var ret = acquit.parse(contents); | ||
it('can parse Mocha\'s `context()` and `specify()`', function() { | ||
var contents = | ||
'context(\'Mocha aliases\', function() {\n' + | ||
' specify(\'should be parsed\', function() {\n' + | ||
' assert.equal(1, 1);\n' + | ||
' });\n' + | ||
'});'; | ||
var contents = ` | ||
context('Mocha aliases', function() { | ||
specify('should be parsed', function() { | ||
assert.equal(1, 1); | ||
}); | ||
}); | ||
`; | ||
@@ -162,4 +167,4 @@ var ret = acquit.parse(contents); | ||
it('strips out whitespace and asterisks in multiline comments', function() { | ||
var str = ' * This comment looks like a \n' + | ||
' * parsed JSdoc-style comment'; | ||
var str = ` * This comment looks like a | ||
* parsed JSdoc-style comment`; | ||
@@ -174,4 +179,4 @@ assert.equal(acquit.trimEachLine(str), 'This comment looks like a\n' + | ||
it('strips out whitespace and asterisks in multiline comments', function() { | ||
var str = 'This comment looks like a \n' + | ||
' * parsed JSdoc-style comment'; | ||
var str = `This comment looks like a | ||
* parsed JSdoc-style comment`; | ||
@@ -194,16 +199,16 @@ assert.equal(acquit.trimEachLine(str), 'This comment looks like a\n' + | ||
it('can transform acquit output', function() { | ||
var contents = [ | ||
'describe("My feature", function() {', | ||
' it("works", function() {', | ||
' // some code', | ||
' });', | ||
'});' | ||
].join('\n'); | ||
var contents = ` | ||
describe("My feature", function() { | ||
it("works", function() { | ||
// some code | ||
}); | ||
}); | ||
`; | ||
acquit.output(function(res) { | ||
return [ | ||
'# ' + res[0].contents, | ||
'\n', | ||
'## ' + res[0].blocks[0].contents | ||
].join('\n'); | ||
return ` | ||
# ${res[0].contents} | ||
## ${res[0].blocks[0].contents} | ||
`; | ||
}); | ||
@@ -213,7 +218,7 @@ | ||
assert.equal(res, [ | ||
'# My feature', | ||
'\n', | ||
'## works' | ||
].join('\n')); | ||
assert.equal(res.trim(), ` | ||
# My feature | ||
## works | ||
`.trim()); | ||
acquit.removeAllTransforms(); | ||
@@ -220,0 +225,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
529
281
37153