Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

Commit

Permalink
test(update): improve tests, add over 130+ tests
Browse files Browse the repository at this point in the history
tests against babylon, acorn, and acorn_loose
  • Loading branch information
tunnckoCore committed Dec 9, 2016
1 parent 7fd2605 commit 3208182
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 143 deletions.
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = function parseFunction (code, options) {
const body = ast.program && ast.program.body ? ast.program.body : ast.body

body.forEach((node) => {
/* istanbul ignore next */
if (node.type !== 'ExpressionStatement' && node.type !== 'FunctionDeclaration') {
return
}
Expand Down Expand Up @@ -99,9 +100,7 @@ function visitArrows (node, result) {

function visitFunctions (node, result) {
if (node.type === 'FunctionDeclaration') {
result.name = node.id.start === node.id.end
? 'anonymous'
: node.id.name
result.name = node.id.name
}

return node
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test": "npm run coverage",
"posttest": "npm run lint:coverage",
"coverage": "nyc node test.js",
"lint:coverage": "nyc check-coverage --lines 0 --branches 0 --statements 0 --functions 0",
"lint:coverage": "nyc check-coverage --lines 100 --branches 100 --statements 100 --functions 100",
"report-coverage": "nyc report --reporter=text-lcov | coveralls",
"prerelease": "npm test",
"release": "standard-version --sign --no-verify",
Expand All @@ -25,6 +25,7 @@
"define-property": "^0.2.5"
},
"devDependencies": {
"clone-deep": "^0.2.4",
"commitizen": "^2.8.6",
"coveralls": "^2.11.15",
"cz-conventional-changelog": "^1.2.0",
Expand Down

0 comments on commit 3208182

Please sign in to comment.