Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 83c845b

Browse files
committedApr 23, 2018
Got the tests and code working for supporting non-file documenting
1 parent f5e369f commit 83c845b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed
 

‎__tests__/test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ export default {
262262
}
263263
}
264264
}`;
265-
const data = await documentation.build([{ source: documentationSource }], {});
265+
const data = await documentation.build([{ source: documentationSource }], {
266+
shallow: true
267+
});
266268
normalize(data);
267269
expect(data).toMatchSnapshot();
268270
});

‎src/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,11 @@ function buildInternal(inputsAndConfig) {
105105
sourceFile.source = fs.readFileSync(sourceFile.file, 'utf8');
106106
}
107107

108-
if (
109-
typeof sourceFile.file === 'string' &&
110-
path.extname(sourceFile.file) === '.vue'
111-
) {
108+
if (!sourceFile.file) {
109+
sourceFile.file = '';
110+
}
111+
112+
if (path.extname(sourceFile.file) === '.vue') {
112113
return parseVueScript(sourceFile, config).map(buildPipeline);
113114
}
114115
return parseJavaScript(sourceFile, config).map(buildPipeline);

0 commit comments

Comments
 (0)
Please sign in to comment.