@@ -5,6 +5,10 @@ import os from 'os';
5
5
import { exec } from 'child_process' ;
6
6
import tmp from 'tmp' ;
7
7
import fs from 'fs-extra' ;
8
+ import { fileURLToPath } from 'url' ;
9
+
10
+ const __filename = fileURLToPath ( import . meta. url ) ;
11
+ const __dirname = path . dirname ( __filename ) ;
8
12
9
13
function documentation ( args , options , parseJSON ) {
10
14
if ( ! options ) {
@@ -44,7 +48,7 @@ function normalize(result) {
44
48
return result ;
45
49
}
46
50
47
- test . skip ( 'documentation binary' , async function ( ) {
51
+ test ( 'documentation binary' , async function ( ) {
48
52
const data = await documentation ( [ 'build fixture/simple.input.js' ] , { } ) ;
49
53
expect ( data . length ) . toBe ( 1 ) ;
50
54
} ) ;
@@ -56,14 +60,14 @@ test.skip('defaults to parsing package.json main', async function () {
56
60
expect ( data . length ) . toBeTruthy ( ) ;
57
61
} ) ;
58
62
59
- test . skip ( 'accepts config file' , async function ( ) {
63
+ test ( 'accepts config file' , async function ( ) {
60
64
const data = await documentation ( [
61
65
'build fixture/sorting/input.js -c fixture/config.json'
62
66
] ) ;
63
67
expect ( normalize ( data ) ) . toMatchSnapshot ( ) ;
64
68
} ) ;
65
69
66
- test . skip ( 'accepts config file - reports failures' , async function ( ) {
70
+ test ( 'accepts config file - reports failures' , async function ( ) {
67
71
try {
68
72
await documentation (
69
73
[ 'build fixture/sorting/input.js -c fixture/config-bad.yml' ] ,
@@ -75,7 +79,7 @@ test.skip('accepts config file - reports failures', async function () {
75
79
}
76
80
} ) ;
77
81
78
- test . skip ( 'accepts config file - reports parse failures' , async function ( ) {
82
+ test ( 'accepts config file - reports parse failures' , async function ( ) {
79
83
try {
80
84
await documentation (
81
85
[ 'build fixture/sorting/input.js -c fixture/config-malformed.json' ] ,
@@ -87,42 +91,42 @@ test.skip('accepts config file - reports parse failures', async function () {
87
91
}
88
92
} ) ;
89
93
90
- test . skip ( '--shallow option' , async function ( ) {
94
+ test ( '--shallow option' , async function ( ) {
91
95
const data = await documentation ( [
92
96
'build --shallow fixture/internal.input.js'
93
97
] ) ;
94
98
expect ( data . length ) . toBe ( 0 ) ;
95
99
} ) ;
96
100
97
- test . skip ( 'external modules option' , async function ( ) {
101
+ test ( 'external modules option' , async function ( ) {
98
102
const data = await documentation ( [
99
103
'build fixture/external.input.js ' +
100
104
'--external=external --external=external/node_modules'
101
105
] ) ;
102
106
expect ( data . length ) . toBe ( 2 ) ;
103
107
} ) ;
104
108
105
- test . skip ( 'when a file is specified both in a glob and explicitly, it is only documented once' , async function ( ) {
109
+ test ( 'when a file is specified both in a glob and explicitly, it is only documented once' , async function ( ) {
106
110
const data = await documentation ( [
107
111
'build fixture/simple.input.js fixture/simple.input.*'
108
112
] ) ;
109
113
expect ( data . length ) . toBe ( 1 ) ;
110
114
} ) ;
111
115
112
- test . skip ( 'extension option' , async function ( ) {
116
+ test ( 'extension option' , async function ( ) {
113
117
const data = await documentation ( [
114
118
'build fixture/extension/index.otherextension ' +
115
119
'--requireExtension=otherextension --parseExtension=otherextension'
116
120
] ) ;
117
121
expect ( data . length ) . toBe ( 1 ) ;
118
122
} ) ;
119
123
120
- test . skip ( 'extension option' , function ( ) {
124
+ test ( 'extension option' , function ( ) {
121
125
return documentation ( [ 'build fixture/extension.jsx' ] ) ;
122
126
} ) ;
123
127
124
128
describe ( 'invalid arguments' , function ( ) {
125
- test . skip ( 'bad -f option' , async function ( ) {
129
+ test ( 'bad -f option' , async function ( ) {
126
130
try {
127
131
await documentation (
128
132
[ 'build -f DOES-NOT-EXIST fixture/internal.input.js' ] ,
@@ -134,7 +138,7 @@ describe('invalid arguments', function () {
134
138
}
135
139
} ) ;
136
140
137
- test . skip ( 'html with no destination' , async function ( ) {
141
+ test ( 'html with no destination' , async function ( ) {
138
142
try {
139
143
await documentation ( [ 'build -f html fixture/internal.input.js' ] ) ;
140
144
} catch ( err ) {
@@ -148,7 +152,7 @@ describe('invalid arguments', function () {
148
152
}
149
153
} ) ;
150
154
151
- test . skip ( 'bad command' , async function ( ) {
155
+ test ( 'bad command' , async function ( ) {
152
156
try {
153
157
await documentation ( [ '-f html fixture/internal.input.js' ] , { } , false ) ;
154
158
} catch ( err ) {
@@ -159,7 +163,7 @@ describe('invalid arguments', function () {
159
163
160
164
const semver =
161
165
/ \b v ? (?: 0 | [ 1 - 9 ] \d * ) \. (?: 0 | [ 1 - 9 ] \d * ) \. (?: 0 | [ 1 - 9 ] \d * ) (?: - [ \d a - z - ] + (?: \. [ \d a - z - ] + ) * ) ? (?: \+ [ \d a - z - ] + (?: \. [ \d a - z - ] + ) * ) ? \b / gi;
162
- test . skip ( '--config' , async function ( ) {
166
+ test ( '--config' , async function ( ) {
163
167
const dst = path . join ( os . tmpdir ( ) , ( Date . now ( ) + Math . random ( ) ) . toString ( ) ) ;
164
168
fs . mkdirSync ( dst ) ;
165
169
const outputIndex = path . join ( dst , 'index.html' ) ;
@@ -172,18 +176,18 @@ test.skip('--config', async function () {
172
176
false
173
177
) ;
174
178
let output = fs . readFileSync ( outputIndex , 'utf8' ) ;
175
- const version = require ( '../package.json' ) . version ;
179
+ const version = ( await import ( '../package.json' ) ) . default . version ;
176
180
output = output . replace ( new RegExp ( version . replace ( / \. / g, '\\.' ) , 'g' ) , '' ) ;
177
181
expect ( output ) . toMatchSnapshot ( ) ;
178
182
} ) ;
179
183
180
- test . skip ( '--version' , async function ( ) {
184
+ test ( '--version' , async function ( ) {
181
185
const output = await documentation ( [ '--version' ] , { } , false ) ;
182
186
expect ( output ) . toBeTruthy ( ) ;
183
187
} ) ;
184
188
185
189
describe ( 'lint command' , function ( ) {
186
- test . skip ( 'generates lint output' , async function ( ) {
190
+ test ( 'generates lint output' , async function ( ) {
187
191
try {
188
192
await documentation ( [ 'lint fixture/lint/lint.input.js' ] , { } , false ) ;
189
193
} catch ( err ) {
@@ -192,7 +196,7 @@ describe('lint command', function () {
192
196
}
193
197
} ) ;
194
198
195
- test . skip ( 'generates no output on a good file' , async function ( ) {
199
+ test ( 'generates no output on a good file' , async function ( ) {
196
200
const data = await documentation (
197
201
[ 'lint fixture/simple.input.js' ] ,
198
202
{ } ,
@@ -201,7 +205,7 @@ describe('lint command', function () {
201
205
expect ( data ) . toBe ( '' ) ;
202
206
} ) ;
203
207
204
- test . skip ( 'exposes syntax error on a bad file' , async function ( ) {
208
+ test ( 'exposes syntax error on a bad file' , async function ( ) {
205
209
try {
206
210
await documentation (
207
211
[ 'lint fixture/bad/syntax.input' , '--parseExtension input' ] ,
@@ -213,7 +217,7 @@ describe('lint command', function () {
213
217
}
214
218
} ) ;
215
219
216
- test . skip ( 'lint with no inputs' , async function ( ) {
220
+ test ( 'lint with no inputs' , async function ( ) {
217
221
try {
218
222
await documentation (
219
223
[ 'lint' ] ,
@@ -227,7 +231,7 @@ describe('lint command', function () {
227
231
}
228
232
} ) ;
229
233
230
- test . skip ( 'generates lint output with shallow' , async function ( ) {
234
+ test ( 'generates lint output with shallow' , async function ( ) {
231
235
const data = await documentation (
232
236
[ 'lint fixture/lint/lint.input.shallow.js --shallow' ] ,
233
237
{ } ,
@@ -237,7 +241,7 @@ describe('lint command', function () {
237
241
} ) ;
238
242
} ) ;
239
243
240
- test . skip ( 'given no files' , async function ( ) {
244
+ test ( 'given no files' , async function ( ) {
241
245
try {
242
246
await documentation ( [ 'build' ] ) ;
243
247
} catch ( err ) {
@@ -251,7 +255,7 @@ test.skip('given no files', async function () {
251
255
}
252
256
} ) ;
253
257
254
- test . skip ( 'with an invalid command' , async function ( ) {
258
+ test ( 'with an invalid command' , async function ( ) {
255
259
try {
256
260
await documentation ( [ 'invalid' ] , { } , false ) ;
257
261
} catch ( err ) {
0 commit comments