Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e5b6b9

Browse files
committed
Testing: Support defining options for fixture tests
This reads the fixture file and looks for ```js // Options: <JSON> ``` which it uses as the options for documentation.build and documentation.buildSync.
1 parent bec5d7b commit 3e5b6b9

5 files changed

+28
-303
lines changed

test/fixture/infer-private.input.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Options: {"inferPrivate": "^_"}
2+
13
/**
24
* _p description
35
*/

test/fixture/infer-private.output.json

Lines changed: 10 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,4 @@
11
[
2-
{
3-
"description": {
4-
"type": "root",
5-
"children": [
6-
{
7-
"type": "paragraph",
8-
"children": [
9-
{
10-
"type": "text",
11-
"value": "_p description",
12-
"position": {
13-
"start": {
14-
"line": 1,
15-
"column": 1,
16-
"offset": 0
17-
},
18-
"end": {
19-
"line": 1,
20-
"column": 15,
21-
"offset": 14
22-
},
23-
"indent": []
24-
}
25-
}
26-
],
27-
"position": {
28-
"start": {
29-
"line": 1,
30-
"column": 1,
31-
"offset": 0
32-
},
33-
"end": {
34-
"line": 1,
35-
"column": 15,
36-
"offset": 14
37-
},
38-
"indent": []
39-
}
40-
}
41-
],
42-
"position": {
43-
"start": {
44-
"line": 1,
45-
"column": 1,
46-
"offset": 0
47-
},
48-
"end": {
49-
"line": 1,
50-
"column": 15,
51-
"offset": 14
52-
}
53-
}
54-
},
55-
"tags": [],
56-
"loc": {
57-
"start": {
58-
"line": 1,
59-
"column": 0
60-
},
61-
"end": {
62-
"line": 3,
63-
"column": 3
64-
}
65-
},
66-
"context": {
67-
"loc": {
68-
"start": {
69-
"line": 4,
70-
"column": 0
71-
},
72-
"end": {
73-
"line": 4,
74-
"column": 16
75-
}
76-
},
77-
"code": "/**\n * _p description\n */\nfunction _p() {}\n\n/** C description */\nclass C {\n /** m description */\n m() {}\n /** _p description */\n _p() {}\n}\n"
78-
},
79-
"errors": [],
80-
"name": "_p",
81-
"kind": "function",
82-
"members": {
83-
"instance": [],
84-
"static": []
85-
},
86-
"path": [
87-
{
88-
"name": "_p",
89-
"kind": "function"
90-
}
91-
],
92-
"namespace": "_p"
93-
},
942
{
953
"description": {
964
"type": "root",
@@ -147,26 +55,26 @@
14755
"tags": [],
14856
"loc": {
14957
"start": {
150-
"line": 6,
58+
"line": 8,
15159
"column": 0
15260
},
15361
"end": {
154-
"line": 6,
62+
"line": 8,
15563
"column": 20
15664
}
15765
},
15866
"context": {
15967
"loc": {
16068
"start": {
161-
"line": 7,
69+
"line": 9,
16270
"column": 0
16371
},
16472
"end": {
165-
"line": 12,
73+
"line": 14,
16674
"column": 1
16775
}
16876
},
169-
"code": "/**\n * _p description\n */\nfunction _p() {}\n\n/** C description */\nclass C {\n /** m description */\n m() {}\n /** _p description */\n _p() {}\n}\n"
77+
"code": "// Options: {\"inferPrivate\": \"^_\"}\n\n/**\n * _p description\n */\nfunction _p() {}\n\n/** C description */\nclass C {\n /** m description */\n m() {}\n /** _p description */\n _p() {}\n}\n"
17078
},
17179
"errors": [],
17280
"name": "C",
@@ -229,26 +137,26 @@
229137
"tags": [],
230138
"loc": {
231139
"start": {
232-
"line": 8,
140+
"line": 10,
233141
"column": 2
234142
},
235143
"end": {
236-
"line": 8,
144+
"line": 10,
237145
"column": 22
238146
}
239147
},
240148
"context": {
241149
"loc": {
242150
"start": {
243-
"line": 9,
151+
"line": 11,
244152
"column": 2
245153
},
246154
"end": {
247-
"line": 9,
155+
"line": 11,
248156
"column": 8
249157
}
250158
},
251-
"code": "/**\n * _p description\n */\nfunction _p() {}\n\n/** C description */\nclass C {\n /** m description */\n m() {}\n /** _p description */\n _p() {}\n}\n"
159+
"code": "// Options: {\"inferPrivate\": \"^_\"}\n\n/**\n * _p description\n */\nfunction _p() {}\n\n/** C description */\nclass C {\n /** m description */\n m() {}\n /** _p description */\n _p() {}\n}\n"
252160
},
253161
"errors": [],
254162
"name": "m",
@@ -271,105 +179,6 @@
271179
}
272180
],
273181
"namespace": "C#m"
274-
},
275-
{
276-
"description": {
277-
"type": "root",
278-
"children": [
279-
{
280-
"type": "paragraph",
281-
"children": [
282-
{
283-
"type": "text",
284-
"value": "_p description",
285-
"position": {
286-
"start": {
287-
"line": 1,
288-
"column": 1,
289-
"offset": 0
290-
},
291-
"end": {
292-
"line": 1,
293-
"column": 15,
294-
"offset": 14
295-
},
296-
"indent": []
297-
}
298-
}
299-
],
300-
"position": {
301-
"start": {
302-
"line": 1,
303-
"column": 1,
304-
"offset": 0
305-
},
306-
"end": {
307-
"line": 1,
308-
"column": 15,
309-
"offset": 14
310-
},
311-
"indent": []
312-
}
313-
}
314-
],
315-
"position": {
316-
"start": {
317-
"line": 1,
318-
"column": 1,
319-
"offset": 0
320-
},
321-
"end": {
322-
"line": 1,
323-
"column": 15,
324-
"offset": 14
325-
}
326-
}
327-
},
328-
"tags": [],
329-
"loc": {
330-
"start": {
331-
"line": 10,
332-
"column": 2
333-
},
334-
"end": {
335-
"line": 10,
336-
"column": 23
337-
}
338-
},
339-
"context": {
340-
"loc": {
341-
"start": {
342-
"line": 11,
343-
"column": 2
344-
},
345-
"end": {
346-
"line": 11,
347-
"column": 9
348-
}
349-
},
350-
"code": "/**\n * _p description\n */\nfunction _p() {}\n\n/** C description */\nclass C {\n /** m description */\n m() {}\n /** _p description */\n _p() {}\n}\n"
351-
},
352-
"errors": [],
353-
"name": "_p",
354-
"kind": "function",
355-
"memberof": "C",
356-
"scope": "instance",
357-
"members": {
358-
"instance": [],
359-
"static": []
360-
},
361-
"path": [
362-
{
363-
"name": "C",
364-
"kind": "class"
365-
},
366-
{
367-
"name": "_p",
368-
"kind": "function",
369-
"scope": "instance"
370-
}
371-
],
372-
"namespace": "C#_p"
373182
}
374183
],
375184
"static": [],

test/fixture/infer-private.output.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
# \_p
2-
3-
\_p description
4-
51
# C
62

73
C description
84

95
## m
106

117
m description
12-
13-
## \_p
14-
15-
\_p description
Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,6 @@
11
{
22
"type": "root",
33
"children": [
4-
{
5-
"depth": 1,
6-
"type": "heading",
7-
"children": [
8-
{
9-
"type": "text",
10-
"value": "_p"
11-
}
12-
]
13-
},
14-
{
15-
"type": "paragraph",
16-
"children": [
17-
{
18-
"type": "text",
19-
"value": "_p description",
20-
"position": {
21-
"start": {
22-
"line": 1,
23-
"column": 1,
24-
"offset": 0
25-
},
26-
"end": {
27-
"line": 1,
28-
"column": 15,
29-
"offset": 14
30-
},
31-
"indent": []
32-
}
33-
}
34-
],
35-
"position": {
36-
"start": {
37-
"line": 1,
38-
"column": 1,
39-
"offset": 0
40-
},
41-
"end": {
42-
"line": 1,
43-
"column": 15,
44-
"offset": 14
45-
},
46-
"indent": []
47-
}
48-
},
494
{
505
"depth": 1,
516
"type": "heading",
@@ -135,51 +90,6 @@
13590
},
13691
"indent": []
13792
}
138-
},
139-
{
140-
"depth": 2,
141-
"type": "heading",
142-
"children": [
143-
{
144-
"type": "text",
145-
"value": "_p"
146-
}
147-
]
148-
},
149-
{
150-
"type": "paragraph",
151-
"children": [
152-
{
153-
"type": "text",
154-
"value": "_p description",
155-
"position": {
156-
"start": {
157-
"line": 1,
158-
"column": 1,
159-
"offset": 0
160-
},
161-
"end": {
162-
"line": 1,
163-
"column": 15,
164-
"offset": 14
165-
},
166-
"indent": []
167-
}
168-
}
169-
],
170-
"position": {
171-
"start": {
172-
"line": 1,
173-
"column": 1,
174-
"offset": 0
175-
},
176-
"end": {
177-
"line": 1,
178-
"column": 15,
179-
"offset": 14
180-
},
181-
"indent": []
182-
}
18393
}
18494
]
18595
}

0 commit comments

Comments
 (0)