File tree Expand file tree Collapse file tree 4 files changed +76
-2
lines changed
packages/doxdox-parser-custom Expand file tree Collapse file tree 4 files changed +76
-2
lines changed Original file line number Diff line number Diff line change @@ -1182,3 +1182,47 @@ exports[`custom parser parse parse example jsdoc headers (function methods) 1`]
1182
1182
" path" : " ./test/mocks/function.js" ,
1183
1183
}
1184
1184
` ;
1185
+
1186
+ exports [` custom parser tag tests public/private scope 1` ] = `
1187
+ {
1188
+ " methods" : [
1189
+ {
1190
+ " description" : " " ,
1191
+ " fullName" : " privateMethod()" ,
1192
+ " name" : " privateMethod" ,
1193
+ " params" : [],
1194
+ " private" : true ,
1195
+ " returns" : [],
1196
+ " slug" : " test-mocks-scope-js-privatemethod" ,
1197
+ },
1198
+ {
1199
+ " description" : " " ,
1200
+ " fullName" : " privateMethod()" ,
1201
+ " name" : " privateMethod" ,
1202
+ " params" : [],
1203
+ " private" : true ,
1204
+ " returns" : [],
1205
+ " slug" : " test-mocks-scope-js-privatemethod" ,
1206
+ },
1207
+ {
1208
+ " description" : " " ,
1209
+ " fullName" : " publicMethod()" ,
1210
+ " name" : " publicMethod" ,
1211
+ " params" : [],
1212
+ " private" : false ,
1213
+ " returns" : [],
1214
+ " slug" : " test-mocks-scope-js-publicmethod" ,
1215
+ },
1216
+ {
1217
+ " description" : " " ,
1218
+ " fullName" : " publicMethod()" ,
1219
+ " name" : " publicMethod" ,
1220
+ " params" : [],
1221
+ " private" : false ,
1222
+ " returns" : [],
1223
+ " slug" : " test-mocks-scope-js-publicmethod" ,
1224
+ },
1225
+ ],
1226
+ " path" : " ./test/mocks/scope.js" ,
1227
+ }
1228
+ ` ;
Original file line number Diff line number Diff line change @@ -27,6 +27,14 @@ describe('custom parser', () => {
27
27
} ) ;
28
28
} ) ;
29
29
30
+ describe ( 'tag tests' , ( ) => {
31
+ it ( 'public/private scope' , async ( ) => {
32
+ await expect (
33
+ parse ( process . cwd ( ) , './test/mocks/scope.js' )
34
+ ) . resolves . toMatchSnapshot ( ) ;
35
+ } ) ;
36
+ } ) ;
37
+
30
38
describe ( 'parse example from JSDoc documentation https://jsdoc.app/' , ( ) => {
31
39
// JSDoc Example from https://jsdoc.app/
32
40
it ( 'parse amd-module' , async ( ) => {
Original file line number Diff line number Diff line change @@ -100,8 +100,11 @@ export const parseString = async (
100
100
const returnTags = method . comment . tags . filter ( ( { tag } ) =>
101
101
/ r e t u r n $ / . test ( tag )
102
102
) ;
103
- const privateScopeTags = method . comment . tags . filter ( ( { tag } ) =>
104
- / p r i v a t e $ / . test ( tag )
103
+
104
+ const privateScopeTags = method . comment . tags . filter (
105
+ ( { tag, name } ) =>
106
+ / p r i v a t e $ / . test ( tag ) ||
107
+ ( tag === 'api' && / p r i v a t e $ / . test ( name ) )
105
108
) ;
106
109
107
110
const params = paramTags . map ( ( { name, description, type } ) => ( {
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @public
3
+ */
4
+ function publicMethod ( ) { }
5
+
6
+ /**
7
+ * @api public
8
+ */
9
+ function publicMethod ( ) { }
10
+
11
+ /**
12
+ * @private
13
+ */
14
+ function privateMethod ( ) { }
15
+
16
+ /**
17
+ * @api private
18
+ */
19
+ function privateMethod ( ) { }
You can’t perform that action at this time.
0 commit comments