Commit 59bdaed 1 parent 5a0d197 commit 59bdaed Copy full SHA for 59bdaed
File tree 2 files changed +14
-4
lines changed
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -121,9 +121,10 @@ return a string that should match the expected output. A second argument `option
121
121
This may contain the options of the fixture. These options are read from the ` options.cjs ` ,
122
122
` options.js ` , ` options.json ` or ` options.mjs ` file in the fixture directory.
123
123
124
- A test may be an object with the ` generate ` and optional ` input ` , ` expected ` properties. In this
125
- case ` input ` determines which input file to read, ` generate ` serves as the generate function, and
126
- ` expected ` refers to the expected output file.
124
+ A test may be an object with the ` generate ` and optional ` input ` , ` expected ` , and ` ignore `
125
+ properties. In this case ` input ` determines which input file to read, ` generate ` serves as the
126
+ generate function, and ` expected ` refers to the expected output file. If ` ignore ` is true, the
127
+ result is written, but assertion failures are ignored.
127
128
128
129
## Compatibility
129
130
Original file line number Diff line number Diff line change @@ -30,6 +30,11 @@ type Generate<Options> = (
30
30
) => Buffer | PromiseLike < Buffer | VFile | string > | VFile | string
31
31
32
32
interface FixtureTest < Options > {
33
+ /**
34
+ * If true, assertion failures are ignored. The expected fixture is still written.
35
+ */
36
+ ignore ?: boolean
37
+
33
38
/**
34
39
* The fixture input file name to read. If the input has an extension, it’s treated as an exact
35
40
* file name. Otherwise, a file is looked up in the fixture directory whose base name matches the
@@ -184,6 +189,7 @@ export function createTest<T>(
184
189
let generate : Generate < T >
185
190
let inputUrl : URL
186
191
let expectedUrl : URL
192
+ let ignore : boolean | undefined
187
193
188
194
if ( typeof spec === 'function' ) {
189
195
generate = spec
@@ -193,6 +199,7 @@ export function createTest<T>(
193
199
generate = spec . generate
194
200
inputUrl = await getInputUrl ( dir , spec . input )
195
201
expectedUrl = new URL ( spec . expected ?? name , dir )
202
+ ignore = spec . ignore
196
203
}
197
204
198
205
const fixtureOptions = await getOptions ( dir )
@@ -244,7 +251,9 @@ export function createTest<T>(
244
251
245
252
/* c8 ignore stop */
246
253
247
- throw error
254
+ if ( ! ignore ) {
255
+ throw error
256
+ }
248
257
}
249
258
}
250
259
}
You can’t perform that action at this time.
0 commit comments