From 5b7a4a2796d69f272a60317d4226b9b80d0e02c7 Mon Sep 17 00:00:00 2001 From: Duarte David Date: Mon, 21 May 2018 01:38:00 +0200 Subject: [PATCH 1/2] fix(export): Handle NamedExports of Imports, export * from and export as Close #442 Part of #361 --- src/Doc/AbstractDoc.js | 8 +++- src/Doc/AssignmentDoc.js | 6 ++- src/Doc/ClassDoc.js | 11 +++--- src/Doc/ClassPropertyDoc.js | 4 +- src/Doc/ExternalDoc.js | 37 +++++++++--------- src/Doc/FileDoc.js | 4 +- src/Doc/FunctionDoc.js | 19 +++++----- src/Doc/MemberDoc.js | 17 +++++---- src/Doc/MethodDoc.js | 13 ++++--- src/Doc/TypedefDoc.js | 25 ++++++------ src/Doc/VariableDoc.js | 37 +++++++++--------- src/ESDoc.js | 30 +++++++++++++-- src/Factory/DocFactory.js | 76 ++++++++++++++++++++++++++++++++++--- src/Util/ASTUtil.js | 28 ++++++++++++++ src/Util/PathResolver.js | 10 +++-- 15 files changed, 232 insertions(+), 93 deletions(-) diff --git a/src/Doc/AbstractDoc.js b/src/Doc/AbstractDoc.js index 35d8e4ba..4830786b 100644 --- a/src/Doc/AbstractDoc.js +++ b/src/Doc/AbstractDoc.js @@ -4,6 +4,7 @@ import ASTUtil from '../Util/ASTUtil.js'; import InvalidCodeLogger from '../Util/InvalidCodeLogger.js'; import ASTNodeContainer from '../Util/ASTNodeContainer.js'; import babelGenerator from 'babel-generator'; +import {name} from '../Factory/DocFactory'; /** * Abstract Doc Class. @@ -97,9 +98,12 @@ export default class AbstractDoc { /** * decide `name` - * @abstract */ - _$name() {} + _$name() { + if (this._node[name]) { + this._value.name = this._node[name]; + } + } /** * decide `memberof`. diff --git a/src/Doc/AssignmentDoc.js b/src/Doc/AssignmentDoc.js index ab5715be..814f88ae 100644 --- a/src/Doc/AssignmentDoc.js +++ b/src/Doc/AssignmentDoc.js @@ -17,8 +17,10 @@ export default class AssignmentDoc extends AbstractDoc { */ _$name() { super._$name(); - const name = this._flattenMemberExpression(this._node.left).replace(/^this\./, ''); - this._value.name = name; + if (!this._value.name) { + const name = this._flattenMemberExpression(this._node.left).replace(/^this\./, ''); + this._value.name = name; + } } /** diff --git a/src/Doc/ClassDoc.js b/src/Doc/ClassDoc.js index f776bef0..b950baa9 100644 --- a/src/Doc/ClassDoc.js +++ b/src/Doc/ClassDoc.js @@ -28,11 +28,12 @@ export default class ClassDoc extends AbstractDoc { /** take out self name from self node */ _$name() { super._$name(); - - if (this._node.id) { - this._value.name = this._node.id.name; - } else { - this._value.name = NamingUtil.filePathToName(this._pathResolver.filePath); + if (!this._value.name) { + if (this._node.id) { + this._value.name = this._node.id.name; + } else { + this._value.name = NamingUtil.filePathToName(this._pathResolver.filePath); + } } } diff --git a/src/Doc/ClassPropertyDoc.js b/src/Doc/ClassPropertyDoc.js index ae55163e..55806755 100644 --- a/src/Doc/ClassPropertyDoc.js +++ b/src/Doc/ClassPropertyDoc.js @@ -26,7 +26,9 @@ export default class ClassPropertyDoc extends AbstractDoc { /** take out self name from self node */ _$name() { super._$name(); - this._value.name = this._node.key.name; + if (!this._value.name) { + this._value.name = this._node.key.name; + } } /** borrow {@link MethodDoc#@_memberof} */ diff --git a/src/Doc/ExternalDoc.js b/src/Doc/ExternalDoc.js index 1d71c7b3..002402ac 100644 --- a/src/Doc/ExternalDoc.js +++ b/src/Doc/ExternalDoc.js @@ -26,27 +26,30 @@ export default class ExternalDoc extends AbstractDoc { /** take out self name from tag */ _$name() { - const value = this._findTagValue(['@external']); - if (!value) { - logger.w('can not resolve name.'); - } + super._$name(); + if (!this._value.name) { + const value = this._findTagValue(['@external']); + if (!value) { + logger.w('can not resolve name.'); + } - this._value.name = value; + this._value.name = value; - const tags = this._findAll(['@external']); - if (!tags) { - logger.w('can not resolve name.'); - return; - } + const tags = this._findAll(['@external']); + if (!tags) { + logger.w('can not resolve name.'); + return; + } - let name; - for (const tag of tags) { - const {typeText, paramDesc} = ParamParser.parseParamValue(tag.tagValue, true, false, true); - name = typeText; - this._value.externalLink = paramDesc; - } + let name; + for (const tag of tags) { + const {typeText, paramDesc} = ParamParser.parseParamValue(tag.tagValue, true, false, true); + name = typeText; + this._value.externalLink = paramDesc; + } - this._value.name = name; + this._value.name = name; + } } /** take out self memberof from file path. */ diff --git a/src/Doc/FileDoc.js b/src/Doc/FileDoc.js index c16549da..52ee66bd 100644 --- a/src/Doc/FileDoc.js +++ b/src/Doc/FileDoc.js @@ -26,7 +26,9 @@ export default class FileDoc extends AbstractDoc { /** take out self name from file path */ _$name() { super._$name(); - this._value.name = this._pathResolver.filePath; + if (!this._value.name) { + this._value.name = this._pathResolver.filePath; + } } /** specify name to longname */ diff --git a/src/Doc/FunctionDoc.js b/src/Doc/FunctionDoc.js index 571bb24b..c2729bbf 100644 --- a/src/Doc/FunctionDoc.js +++ b/src/Doc/FunctionDoc.js @@ -15,17 +15,18 @@ export default class FunctionDoc extends AbstractDoc { /** take out self name from self node */ _$name() { super._$name(); - - if (this._node.id) { - if (this._node.id.type === 'MemberExpression') { - // e.g. foo[bar.baz] = function bal(){} - const expression = babelGenerator(this._node.id).code; - this._value.name = `[${expression}]`; + if (!this._value.name) { + if (this._node.id) { + if (this._node.id.type === 'MemberExpression') { + // e.g. foo[bar.baz] = function bal(){} + const expression = babelGenerator(this._node.id).code; + this._value.name = `[${expression}]`; + } else { + this._value.name = this._node.id.name; + } } else { - this._value.name = this._node.id.name; + this._value.name = NamingUtil.filePathToName(this._pathResolver.filePath); } - } else { - this._value.name = NamingUtil.filePathToName(this._pathResolver.filePath); } } diff --git a/src/Doc/MemberDoc.js b/src/Doc/MemberDoc.js index 5d7377d8..01992c18 100644 --- a/src/Doc/MemberDoc.js +++ b/src/Doc/MemberDoc.js @@ -38,14 +38,17 @@ export default class MemberDoc extends AbstractDoc { /** take out self name from self node */ _$name() { - let name; - if (this._node.left.computed) { - const expression = babelGenerator(this._node.left.property).code.replace(/^this/, ''); - name = `[${expression}]`; - } else { - name = this._flattenMemberExpression(this._node.left).replace(/^this\./, ''); + super._$name(); + if (!this._value.name) { + let name; + if (this._node.left.computed) { + const expression = babelGenerator(this._node.left.property).code.replace(/^this/, ''); + name = `[${expression}]`; + } else { + name = this._flattenMemberExpression(this._node.left).replace(/^this\./, ''); + } + this._value.name = name; } - this._value.name = name; } /** borrow {@link MethodDoc#@_memberof} */ diff --git a/src/Doc/MethodDoc.js b/src/Doc/MethodDoc.js index 63b0437b..3a4524ff 100644 --- a/src/Doc/MethodDoc.js +++ b/src/Doc/MethodDoc.js @@ -26,12 +26,13 @@ export default class MethodDoc extends AbstractDoc { /** take out self name from self node */ _$name() { super._$name(); - - if (this._node.computed) { - const expression = babelGenerator(this._node.key).code; - this._value.name = `[${expression}]`; - } else { - this._value.name = this._node.key.name; + if (!this._value.name) { + if (this._node.computed) { + const expression = babelGenerator(this._node.key).code; + this._value.name = `[${expression}]`; + } else { + this._value.name = this._node.key.name; + } } } diff --git a/src/Doc/TypedefDoc.js b/src/Doc/TypedefDoc.js index 05ee1050..246ace3c 100644 --- a/src/Doc/TypedefDoc.js +++ b/src/Doc/TypedefDoc.js @@ -28,19 +28,22 @@ export default class TypedefDoc extends AbstractDoc { /** set name by using tag. */ _$name() { - const tags = this._findAll(['@typedef']); - if (!tags) { - logger.w('can not resolve name.'); - return; - } + super._$name(); + if (!this._value.name) { + const tags = this._findAll(['@typedef']); + if (!tags) { + logger.w('can not resolve name.'); + return; + } - let name; - for (const tag of tags) { - const {paramName} = ParamParser.parseParamValue(tag.tagValue, true, true, false); - name = paramName; - } + let name; + for (const tag of tags) { + const {paramName} = ParamParser.parseParamValue(tag.tagValue, true, true, false); + name = paramName; + } - this._value.name = name; + this._value.name = name; + } } /** set memberof by using file path. */ diff --git a/src/Doc/VariableDoc.js b/src/Doc/VariableDoc.js index d9007a38..50e1f1be 100644 --- a/src/Doc/VariableDoc.js +++ b/src/Doc/VariableDoc.js @@ -13,24 +13,25 @@ export default class VariableDoc extends AbstractDoc { /** set name by using self node. */ _$name() { super._$name(); - - const type = this._node.declarations[0].id.type; - switch (type) { - case 'Identifier': - this._value.name = this._node.declarations[0].id.name; - break; - case 'ObjectPattern': - // TODO: optimize for multi variables. - // e.g. export const {a, b} = obj - this._value.name = this._node.declarations[0].id.properties[0].key.name; - break; - case 'ArrayPattern': - // TODO: optimize for multi variables. - // e.g. export cont [a, b] = arr - this._value.name = this._node.declarations[0].id.elements.find(v => v).name; - break; - default: - throw new Error(`unknown declarations type: ${type}`); + if (!this._value.name) { + const type = this._node.declarations[0].id.type; + switch (type) { + case 'Identifier': + this._value.name = this._node.declarations[0].id.name; + break; + case 'ObjectPattern': + // TODO: optimize for multi variables. + // e.g. export const {a, b} = obj + this._value.name = this._node.declarations[0].id.properties[0].key.name; + break; + case 'ArrayPattern': + // TODO: optimize for multi variables. + // e.g. export cont [a, b] = arr + this._value.name = this._node.declarations[0].id.elements.find(v => v).name; + break; + default: + throw new Error(`unknown declarations type: ${type}`); + } } } diff --git a/src/ESDoc.js b/src/ESDoc.js index a1440466..447ac0ed 100644 --- a/src/ESDoc.js +++ b/src/ESDoc.js @@ -187,7 +187,7 @@ export default class ESDoc { } /** - * traverse doc comment in JavaScript file. + * Get DocFactory for Javascript File. * @param {string} inDirPath - root directory path. * @param {string} filePath - target JavaScript file path. * @param {string} [packageName] - npm package name of target. @@ -197,18 +197,40 @@ export default class ESDoc { * @property {AST} ast - this is AST of JavaScript file. * @private */ - static _traverse(inDirPath, filePath, packageName, mainFilePath) { + static _getFactory(inDirPath, filePath, packageName, mainFilePath) { logger.i(`parsing: ${filePath}`); let ast; try { ast = ESParser.parse(filePath); } catch (e) { InvalidCodeLogger.showFile(filePath, e); - return null; + return {factory: null, ast: null}; } const pathResolver = new PathResolver(inDirPath, filePath, packageName, mainFilePath); - const factory = new DocFactory(ast, pathResolver); + return { + factory: new DocFactory(ast, pathResolver, (filePath) => this._getFactory(inDirPath, filePath, packageName, mainFilePath)), + ast: ast + }; + } + + /** + * traverse doc comment in JavaScript file. + * @param {string} inDirPath - root directory path. + * @param {string} filePath - target JavaScript file path. + * @param {string} [packageName] - npm package name of target. + * @param {string} [mainFilePath] - npm main file path of target. + * @returns {Object} - return document that is traversed. + * @property {DocObject[]} results - this is contained JavaScript file. + * @property {AST} ast - this is AST of JavaScript file. + * @private + */ + static _traverse(inDirPath, filePath, packageName, mainFilePath) { + const {factory, ast} = this._getFactory(inDirPath, filePath, packageName, mainFilePath); + + if (!factory) { + return null; + } ASTUtil.traverse(ast, (node, parent)=>{ try { diff --git a/src/Factory/DocFactory.js b/src/Factory/DocFactory.js index b29fa422..1d915c85 100644 --- a/src/Factory/DocFactory.js +++ b/src/Factory/DocFactory.js @@ -13,6 +13,9 @@ import ExternalDoc from '../Doc/ExternalDoc.js'; import ASTUtil from '../Util/ASTUtil.js'; const already = Symbol('already'); +const external = Symbol('external'); +const astKey = Symbol('ast'); +export const name = Symbol('name'); /** * Doc factory class. @@ -35,14 +38,16 @@ export default class DocFactory { * @param {AST} ast - AST of source code. * @param {PathResolver} pathResolver - path resolver of source code. */ - constructor(ast, pathResolver) { + constructor(ast, pathResolver, getFactory) { this._ast = ast; this._pathResolver = pathResolver; this._results = []; this._processedClassNodes = []; + this._getFactory = getFactory; this._inspectExportDefaultDeclaration(); this._inspectExportNamedDeclaration(); + this._inspectExportAllDeclaration(); // file doc const doc = new FileDoc(ast, ast, pathResolver, []); @@ -165,6 +170,35 @@ export default class DocFactory { this._ast.program.body.push(...pseudoExportNodes); } + _inspectExportAllDeclaration() { + const pseudoExportNodes = []; + + for (const exportNode of this._ast.program.body) { + if (exportNode.type !== 'ExportAllDeclaration') continue; + + const source = exportNode.source.value; + if (source[0] === '.') { + const path = this._pathResolver.resolve(source, false); + const {ast} = this._getFactory(require.resolve(path)); + for (const node of ast.program.body) { + if (!['ExportNamedDeclaration', 'ExportDefaultDeclaration'].includes(node.type)) continue; + + const pseudoNode = this._copy(node); + if (pseudoNode.declaration) { + pseudoNode.declaration.leadingComments = exportNode.leadingComments; + pseudoNode.declaration[external] = true; + pseudoNode.declaration[astKey] = pseudoNode.declaration[astKey] || ast; + } + pseudoNode.leadingComments = null; + pseudoExportNodes.push(pseudoNode); + } + ASTUtil.sanitize(exportNode); + } + } + + this._ast.program.body.push(...pseudoExportNodes); + } + /* eslint-disable max-statements */ /** * inspect ExportNamedDeclaration. @@ -216,19 +250,20 @@ export default class DocFactory { let targetClassName = null; let pseudoClassExport; - const varNode = ASTUtil.findVariableDeclarationAndNewExpressionNode(specifier.exported.name, this._ast); + const varNode = ASTUtil.findVariableDeclarationAndNewExpressionNode(specifier.local.name, this._ast); if (varNode) { targetClassName = varNode.declarations[0].init.callee.name; pseudoClassExport = true; const pseudoExportNode = this._copy(exportNode); pseudoExportNode.declaration = this._copy(varNode); + pseudoExportNode.declaration[name] = specifier.exported.name; pseudoExportNode.specifiers = null; pseudoExportNodes.push(pseudoExportNode); ASTUtil.sanitize(varNode); } else { - targetClassName = specifier.exported.name; + targetClassName = specifier.local.name; pseudoClassExport = false; } @@ -236,6 +271,7 @@ export default class DocFactory { if (classNode && !exported) { const pseudoExportNode = this._copy(exportNode); pseudoExportNode.declaration = this._copy(classNode); + pseudoExportNode.declaration[name] = targetClassName; pseudoExportNode.leadingComments = null; pseudoExportNode.specifiers = null; pseudoExportNode.declaration.__PseudoExport__ = pseudoClassExport; @@ -243,25 +279,51 @@ export default class DocFactory { ASTUtil.sanitize(classNode); } - const functionNode = ASTUtil.findFunctionDeclarationNode(specifier.exported.name, this._ast); + const functionNode = ASTUtil.findFunctionDeclarationNode(specifier.local.name, this._ast); if (functionNode) { const pseudoExportNode = this._copy(exportNode); pseudoExportNode.declaration = this._copy(functionNode); + pseudoExportNode.declaration[name] = specifier.exported.name; pseudoExportNode.leadingComments = null; pseudoExportNode.specifiers = null; ASTUtil.sanitize(functionNode); pseudoExportNodes.push(pseudoExportNode); } - const variableNode = ASTUtil.findVariableDeclarationNode(specifier.exported.name, this._ast); + const variableNode = ASTUtil.findVariableDeclarationNode(specifier.local.name, this._ast); if (variableNode) { const pseudoExportNode = this._copy(exportNode); pseudoExportNode.declaration = this._copy(variableNode); + pseudoExportNode.declaration[name] = specifier.exported.name; pseudoExportNode.leadingComments = null; pseudoExportNode.specifiers = null; ASTUtil.sanitize(variableNode); pseudoExportNodes.push(pseudoExportNode); } + + const importNode = ASTUtil.findImportDeclarationNode(specifier.local.name, this._ast); + const source = importNode && importNode.source.value; + if (importNode && source[0] === '.') { + const path = this._pathResolver.resolve(source, false); + const {ast} = this._getFactory(require.resolve(path)); + const defaultSpecifier = importNode.specifiers.find(sp => sp.type === 'ImportDefaultSpecifier'); + const n = defaultSpecifier && defaultSpecifier.local.name === specifier.local.name ? 'default' : specifier.local.name; + + const found = ASTUtil.findExportInAst(n, ast); + if (found) { + const pseudoExportNode = this._copy(exportNode); + + pseudoExportNode.declaration = this._copy(found.declaration); + pseudoExportNode.declaration.leadingComments = exportNode.leadingComments; + pseudoExportNode.declaration[external] = true; + pseudoExportNode.declaration[astKey] = ast; + pseudoExportNode.declaration[name] = specifier.exported.name; + + pseudoExportNode.leadingComments = null; + pseudoExportNode.specifiers = null; + pseudoExportNodes.push(pseudoExportNode); + } + } } } @@ -397,7 +459,7 @@ export default class DocFactory { if (!Clazz) return null; if (!node.type) node.type = type; - return new Clazz(this._ast, node, this._pathResolver, tags); + return new Clazz(node[astKey] || this._ast, node, this._pathResolver, tags); } /** @@ -693,6 +755,8 @@ export default class DocFactory { * @private */ _isTopDepthInBody(node, body) { + // From another file, eg: import + if (node[external]) return true; if (!body) return false; if (!Array.isArray(body)) return false; diff --git a/src/Util/ASTUtil.js b/src/Util/ASTUtil.js index 6d41b4ff..afbb0dfc 100644 --- a/src/Util/ASTUtil.js +++ b/src/Util/ASTUtil.js @@ -1,4 +1,5 @@ import babelTraverse from 'babel-traverse'; +import {name} from '../Factory/DocFactory'; /** * Utility for AST. @@ -133,6 +134,33 @@ export default class ASTUtil { return null; } + /** + * find ImportDeclaration node. + * @param {string} name - variable name. + * @param {AST} ast - find in this ast. + * @returns {ASTNode|null} found ast node. + */ + static findImportDeclarationNode(name, ast) { + if (!name) return null; + + for (const node of ast.program.body) { + if (node.type === 'ImportDeclaration' && node.specifiers.some(spec => spec.local.name === name)) return node; + } + + return null; + } + + static findExportInAst(n, ast) { + for (const exportNode of ast.program.body) { + if (exportNode.type === 'ExportNamedDeclaration' && exportNode.declaration && exportNode.declaration[name] === n) { + return exportNode; + } else if (exportNode.type === 'ExportDefaultDeclaration' && n === 'default') { + return exportNode; + } + } + return null; + } + /** * create VariableDeclaration node which has NewExpression. * @param {string} name - variable name. diff --git a/src/Util/PathResolver.js b/src/Util/PathResolver.js index e765220f..b0291507 100644 --- a/src/Util/PathResolver.js +++ b/src/Util/PathResolver.js @@ -79,11 +79,13 @@ export default class PathResolver { * resolve file path on this file. * @param {string} relativePath - relative path on this file. */ - resolve(relativePath) { + resolve(relativePath, relative = true) { const selfDirPath = path.dirname(this._filePath); - const resolvedPath = path.resolve(selfDirPath, relativePath); - const resolvedRelativePath = path.relative(path.dirname(this._inDirPath), resolvedPath); - return this._slash(resolvedRelativePath); + let resolvedPath = path.resolve(selfDirPath, relativePath); + if (relative) { + resolvedPath = path.relative(path.dirname(this._inDirPath), resolvedPath); + } + return this._slash(resolvedPath); } /** From b820e5f15c00143f7a73888191624f21702bb054 Mon Sep 17 00:00:00 2001 From: Duarte David Date: Mon, 21 May 2018 02:38:30 +0200 Subject: [PATCH 2/2] test(new): add tests --- test/integration-test/src/Export/All/All.js | 1 + test/integration-test/src/Export/All/All.test.js | 14 ++++++++++++++ test/integration-test/src/Export/All/Lib.js | 3 +++ test/integration-test/src/Export/Reexport/Lib.js | 10 ++++++++++ .../src/Export/Reexport/Reexport.js | 8 ++++++++ .../src/Export/Reexport/Reexport.test.js | 16 ++++++++++++++++ 6 files changed, 52 insertions(+) create mode 100644 test/integration-test/src/Export/All/All.js create mode 100644 test/integration-test/src/Export/All/All.test.js create mode 100644 test/integration-test/src/Export/All/Lib.js create mode 100644 test/integration-test/src/Export/Reexport/Lib.js create mode 100644 test/integration-test/src/Export/Reexport/Reexport.js create mode 100644 test/integration-test/src/Export/Reexport/Reexport.test.js diff --git a/test/integration-test/src/Export/All/All.js b/test/integration-test/src/Export/All/All.js new file mode 100644 index 00000000..f81394c4 --- /dev/null +++ b/test/integration-test/src/Export/All/All.js @@ -0,0 +1 @@ +export * from './Lib.js' \ No newline at end of file diff --git a/test/integration-test/src/Export/All/All.test.js b/test/integration-test/src/Export/All/All.test.js new file mode 100644 index 00000000..100c3f24 --- /dev/null +++ b/test/integration-test/src/Export/All/All.test.js @@ -0,0 +1,14 @@ +import assert from 'assert'; +import {find} from '../../../util'; + +describe('test/Export/All/All:', ()=>{ + it('re exported all the exports', ()=>{ + const doc1 = find('longname', 'src/Export/All/All.js~a'); + const doc2 = find('longname', 'src/Export/All/All.js~b'); + const doc3 = find('longname', 'src/Export/All/All.js~c'); + + assert.equal(doc1.export, true); + assert.equal(doc2.export, true); + assert.equal(doc3.export, true); + }) +}); diff --git a/test/integration-test/src/Export/All/Lib.js b/test/integration-test/src/Export/All/Lib.js new file mode 100644 index 00000000..ac0bb00c --- /dev/null +++ b/test/integration-test/src/Export/All/Lib.js @@ -0,0 +1,3 @@ +export const a = 1; +export const b = 2; +export const c = 3; \ No newline at end of file diff --git a/test/integration-test/src/Export/Reexport/Lib.js b/test/integration-test/src/Export/Reexport/Lib.js new file mode 100644 index 00000000..6e68f74b --- /dev/null +++ b/test/integration-test/src/Export/Reexport/Lib.js @@ -0,0 +1,10 @@ +const a = 1; +const b = 2; +const c = 3; +const d = 4; +export { + a, + b, + c +}; +export default d; \ No newline at end of file diff --git a/test/integration-test/src/Export/Reexport/Reexport.js b/test/integration-test/src/Export/Reexport/Reexport.js new file mode 100644 index 00000000..ed4ce4c5 --- /dev/null +++ b/test/integration-test/src/Export/Reexport/Reexport.js @@ -0,0 +1,8 @@ +import d, { a, b, c } from './Lib.js' + +export { + a, + b, + c, + d +} \ No newline at end of file diff --git a/test/integration-test/src/Export/Reexport/Reexport.test.js b/test/integration-test/src/Export/Reexport/Reexport.test.js new file mode 100644 index 00000000..498b37d5 --- /dev/null +++ b/test/integration-test/src/Export/Reexport/Reexport.test.js @@ -0,0 +1,16 @@ +import assert from 'assert'; +import {find} from '../../../util'; + +describe('test/Export/Reexport/Reexport:', ()=>{ + it('re exported all the exports', ()=>{ + const doc1 = find('longname', 'src/Export/Reexport/Reexport.js~a'); + const doc2 = find('longname', 'src/Export/Reexport/Reexport.js~b'); + const doc3 = find('longname', 'src/Export/Reexport/Reexport.js~c'); + const doc4 = find('longname', 'src/Export/Reexport/Reexport.js~d'); + + assert.equal(doc1.export, true); + assert.equal(doc2.export, true); + assert.equal(doc3.export, true); + assert.equal(doc4.export, true); + }) +});