Comparing version 0.6.1 to 0.6.2
@@ -0,1 +1,5 @@ | ||
0.6.2 / 2018-03-31 | ||
================== | ||
* fix(parse): filter out leading comments that are in previous blocks due to esprima quirks | ||
0.6.1 / 2018-03-08 | ||
@@ -2,0 +6,0 @@ ================== |
@@ -17,2 +17,4 @@ var _ = require('lodash'); | ||
ret.result = {}; | ||
var existingRanges = []; | ||
var blockFns = ['it', 'specify']; | ||
@@ -34,8 +36,15 @@ ret.visit = function(node, parent, context) { | ||
_.get(node, 'expression.type') === 'CallExpression' && | ||
(_.get(node, 'expression.callee.name') === 'it' || _.get(node, 'expression.callee.name') === 'specify') && | ||
blockFns.indexOf(_.get(node, 'expression.callee.name')) !== -1 && | ||
_.get(node, 'expression.arguments.length', 0) > 1) { | ||
// Weird but esprima sometimes treats the last comment in a previous | ||
// `it()` block as a leading comment for the next `it()` block, so | ||
// filter out comments that are in other `it()` blocks. | ||
var _comments = existingRanges.length === 0 ? | ||
node.leadingComments : | ||
(node.leadingComments || []).filter(c => c.range[0] > _.last(existingRanges)[1]); | ||
existingRanges.push(node.range); | ||
var block = { | ||
type: 'it', | ||
contents: node.expression.arguments[0].value, | ||
comments: _.takeRight(_.map(node.leadingComments || [], 'value')), | ||
comments: _.map(_comments || [], 'value'), | ||
code: contents.substring(node.expression.arguments[1].body.range[0] + 1, node.expression.arguments[1].body.range[1] - 1) | ||
@@ -42,0 +51,0 @@ }; |
{ | ||
"name": "acquit", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "Parse BDD-style tests (Mocha, Jasmine) to generate documentation", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
35805
437