Please enable JavaScript to use RhodeCode Enterprise
Commit Description:
submission report
Commit Description:
submission report
var falafel = require ( '../' );
var test = require ( 'tape' );
var semver = require ( 'semver' );
// acorn-jsx requires node 4
test ( 'custom parser' , { skip : semver . satisfies ( process . version , '< 4.0.0' ) }, function ( t ) {
var acorn = require ( 'acorn' );
var jsx = require ( 'acorn-jsx' );
var acornWithJsx = acorn . Parser . extend ( jsx ());
var src = '(function() { var f = {a: "b"}; var a = <div {...f} className="test"></div>; })()' ;
var nodeTypes = [
'Identifier' ,
'Identifier' ,
'Literal' ,
'Property' ,
'ObjectExpression' ,
'VariableDeclarator' ,
'VariableDeclaration' ,
'Identifier' ,
'Identifier' ,
'JSXSpreadAttribute' ,
'JSXIdentifier' ,
'Literal' ,
'JSXAttribute' ,
'JSXIdentifier' ,
'JSXOpeningElement' ,
'JSXIdentifier' ,
'JSXClosingElement' ,
'JSXElement' ,
'VariableDeclarator' ,
'VariableDeclaration' ,
'BlockStatement' ,
'FunctionExpression' ,
'CallExpression' ,
'ExpressionStatement' ,
'Program'
];
t . plan ( nodeTypes . length );
var output = falafel ( src , { parser : acornWithJsx , ecmaVersion : 6 , plugins : { jsx : true }}, function ( node ) {
t . equal ( node . type , nodeTypes . shift ());
});
});
Site-wide shortcuts
/
Use quick search box
g h
Goto home page
g g
Goto my private gists page
g G
Goto my public gists page
n r
New repository page
n g
New gist page
Repositories
g s
Goto summary page
g c
Goto changelog page
g f
Goto files page
g F
Goto files page with file search activated
g p
Goto pull requests page
g o
Goto repository settings
g O
Goto repository permissions settings