flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
46
VISUALIZACION/node_modules/falafel/test/custom-parser.js
generated
vendored
Executable file
46
VISUALIZACION/node_modules/falafel/test/custom-parser.js
generated
vendored
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
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());
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue