@@ -20,30 +20,30 @@ function documentation(args, options) {
20
20
}
21
21
22
22
function normalize ( result ) {
23
- result . forEach ( function ( item ) {
23
+ result . forEach ( function ( item ) {
24
24
item . context . file = '[path]' ;
25
25
} ) ;
26
26
return result ;
27
27
}
28
28
29
29
const timeout = 20000 ;
30
30
31
- test . skip ( 'harness' , function ( ) {
31
+ test . skip ( 'harness' , function ( ) {
32
32
const docProcess = documentation ( [ 'serve' , 'fixture/simple.input.js' ] ) ;
33
33
expect ( docProcess ) . toBeTruthy ( ) ;
34
34
docProcess . kill ( ) ;
35
35
} ) ;
36
36
37
37
test . skip (
38
38
'provides index.html' ,
39
- function ( ) {
39
+ function ( ) {
40
40
const docProcess = documentation ( [ 'serve' , 'fixture/simple.input.js' ] ) ;
41
- return pEvent ( docProcess . stdout , 'data' ) . then ( function ( data ) {
41
+ return pEvent ( docProcess . stdout , 'data' ) . then ( function ( data ) {
42
42
const portNumber = data
43
43
. toString ( )
44
44
. match ( / d o c u m e n t a t i o n .j s s e r v i n g o n p o r t ( \d + ) / ) ;
45
45
expect ( portNumber ) . toBeTruthy ( ) ;
46
- return get ( `http://localhost:${ portNumber [ 1 ] } /` ) . then ( function ( text ) {
46
+ return get ( `http://localhost:${ portNumber [ 1 ] } /` ) . then ( function ( text ) {
47
47
expect ( text . match ( / < h t m l > / ) ) . toBeTruthy ( ) ;
48
48
docProcess . kill ( ) ;
49
49
} ) ;
@@ -54,18 +54,18 @@ test.skip(
54
54
55
55
test . skip (
56
56
'accepts port argument' ,
57
- function ( ) {
57
+ function ( ) {
58
58
const docProcess = documentation ( [
59
59
'serve' ,
60
60
'fixture/simple.input.js' ,
61
61
'--port=4004'
62
62
] ) ;
63
- return pEvent ( docProcess . stdout , 'data' ) . then ( function ( data ) {
63
+ return pEvent ( docProcess . stdout , 'data' ) . then ( function ( data ) {
64
64
const portNumber = data
65
65
. toString ( )
66
66
. match ( / d o c u m e n t a t i o n .j s s e r v i n g o n p o r t 4 0 0 4 / ) ;
67
67
expect ( portNumber ) . toBeTruthy ( ) ;
68
- return get ( `http://localhost:4004/` ) . then ( function ( text ) {
68
+ return get ( `http://localhost:4004/` ) . then ( function ( text ) {
69
69
expect ( text . match ( / < h t m l > / ) ) . toBeTruthy ( ) ;
70
70
docProcess . kill ( ) ;
71
71
} ) ;
@@ -76,20 +76,20 @@ test.skip(
76
76
77
77
test . skip (
78
78
'--watch' ,
79
- function ( done ) {
79
+ function ( done ) {
80
80
const tmpFile = path . join ( os . tmpdir ( ) , '/simple.js' ) ;
81
81
fs . writeFileSync ( tmpFile , '/** a function */function apples() {}' ) ;
82
82
const docProcess = documentation ( [ 'serve' , tmpFile , '--watch' ] ) ;
83
- pEvent ( docProcess . stdout , 'data' ) . then ( function ( data ) {
83
+ pEvent ( docProcess . stdout , 'data' ) . then ( function ( data ) {
84
84
const portNumber = data
85
85
. toString ( )
86
86
. match ( / d o c u m e n t a t i o n .j s s e r v i n g o n p o r t ( \d + ) / ) ;
87
87
expect ( portNumber ) . toBeTruthy ( ) ;
88
- return get ( `http://localhost:${ portNumber [ 1 ] } /` ) . then ( function ( text ) {
88
+ return get ( `http://localhost:${ portNumber [ 1 ] } /` ) . then ( function ( text ) {
89
89
expect ( text . match ( / a p p l e s / ) ) . toBeTruthy ( ) ;
90
90
fs . writeFileSync ( tmpFile , '/** a function */function bananas() {}' ) ;
91
91
function doGet ( ) {
92
- get ( `http://localhost:${ portNumber [ 1 ] } /` ) . then ( function ( text ) {
92
+ get ( `http://localhost:${ portNumber [ 1 ] } /` ) . then ( function ( text ) {
93
93
if ( text . match ( / b a n a n a s / ) ) {
94
94
docProcess . kill ( ) ;
95
95
done ( ) ;
@@ -107,23 +107,23 @@ test.skip(
107
107
108
108
test . skip (
109
109
'--watch' ,
110
- function ( done ) {
110
+ function ( done ) {
111
111
const tmpDir = os . tmpdir ( ) ;
112
112
const a = path . join ( tmpDir , '/simple.js' ) ;
113
113
const b = path . join ( tmpDir , '/required.js' ) ;
114
114
fs . writeFileSync ( a , 'require("./required")' ) ;
115
115
fs . writeFileSync ( b , '/** soup */function soup() {}' ) ;
116
116
const docProcess = documentation ( [ 'serve' , a , '--watch' ] ) ;
117
- docProcess . stdout . once ( 'data' , function ( data ) {
117
+ docProcess . stdout . once ( 'data' , function ( data ) {
118
118
const portNumber = data
119
119
. toString ( )
120
120
. match ( / d o c u m e n t a t i o n .j s s e r v i n g o n p o r t ( \d + ) / ) ;
121
121
expect ( portNumber ) . toBeTruthy ( ) ;
122
- get ( `http://localhost:${ portNumber [ 1 ] } /` ) . then ( function ( text ) {
122
+ get ( `http://localhost:${ portNumber [ 1 ] } /` ) . then ( function ( text ) {
123
123
expect ( text . match ( / s o u p / ) ) . toBeTruthy ( ) ;
124
124
fs . writeFileSync ( b , '/** nuts */function nuts() {}' ) ;
125
125
function doGet ( ) {
126
- get ( `http://localhost:${ portNumber [ 1 ] } /` ) . then ( function ( text ) {
126
+ get ( `http://localhost:${ portNumber [ 1 ] } /` ) . then ( function ( text ) {
127
127
if ( text . match ( / n u t s / ) ) {
128
128
docProcess . kill ( ) ;
129
129
done ( ) ;
@@ -141,17 +141,17 @@ test.skip(
141
141
142
142
test . skip (
143
143
'error page' ,
144
- function ( ) {
144
+ function ( ) {
145
145
const tmpDir = os . tmpdir ( ) ;
146
146
const a = path . join ( tmpDir , '/simple.js' ) ;
147
147
fs . writeFileSync ( a , '**' ) ;
148
148
const docProcess = documentation ( [ 'serve' , a , '--watch' ] ) ;
149
- return pEvent ( docProcess . stdout , 'data' ) . then ( function ( data ) {
149
+ return pEvent ( docProcess . stdout , 'data' ) . then ( function ( data ) {
150
150
const portNumber = data
151
151
. toString ( )
152
152
. match ( / d o c u m e n t a t i o n .j s s e r v i n g o n p o r t ( \d + ) / ) ;
153
153
expect ( portNumber ) . toBeTruthy ( ) ;
154
- return get ( `http://localhost:${ portNumber [ 1 ] } /` ) . then ( function ( text ) {
154
+ return get ( `http://localhost:${ portNumber [ 1 ] } /` ) . then ( function ( text ) {
155
155
expect ( text . match ( / U n e x p e c t e d t o k e n / ) ) . toBeTruthy ( ) ;
156
156
docProcess . kill ( ) ;
157
157
} ) ;
0 commit comments