How to use findIncludeExclude method in storybook-root

Best JavaScript code snippet using storybook-root

traverse-helpers.js

Source:traverse-helpers.js Github

copy

Full Screen

...60 default:61 throw new Error(`Unexpected descriptor: ${type}`);62 }63}64function findIncludeExclude(ast) {65 const program = (ast && ast.program) || ast;66 const metaDeclaration =67 program &&68 program.body &&69 program.body.find(70 (d) =>71 d.type === 'ExportDefaultDeclaration' &&72 d.declaration.type === 'ObjectExpression' &&73 (d.declaration.properties || []).length74 );75 const includeStories = getDescriptor(metaDeclaration, 'includeStories');76 const excludeStories = getDescriptor(metaDeclaration, 'excludeStories');77 return {78 includeStories,79 excludeStories,80 };81}82export function splitExports(ast, source) {83 const parts = [];84 let lastIndex = 0;85 const includeExclude = findIncludeExclude(ast);86 estraverse.traverse(ast, {87 fallback: 'iteration',88 enter: (node) => {89 patchNode(node);90 const isNamedExport = node.type === 'ExportNamedDeclaration' && node.declaration;91 const isFunctionVariableExport =92 isNamedExport && isFunctionVariable(node.declaration.declarations, includeExclude);93 const isFunctionDeclarationExport =94 isNamedExport && isFunctionDeclaration(node.declaration, includeExclude);95 if (isFunctionDeclarationExport || isFunctionVariableExport) {96 const functionNode = isFunctionVariableExport97 ? node.declaration.declarations[0].init98 : node.declaration;99 parts.push({...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful