You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* The 'info' option was rarely used and is no longer supported.
* The 'info' has been replaced by the similar 'optional' option.
* Optional tests do not count towards passed, failed or total tests run.
* Optional tests can be inspected via the API and Command Line Interface.
* Optional tests are shown differently to other tests in the CLI output.
* Includes new tests in the Google preset that use this option.
@@ -404,16 +441,22 @@ When `warning` is set to `true`, if the test does not pass it will only result i
404
441
405
442
The default is `false`, meaning if the test fails it will be counted as a failure.
406
443
407
-
#### info
444
+
#### optional
408
445
```
409
446
Type: boolean
410
447
Required: false
411
448
Default: false
412
449
```
413
450
414
-
When `info` is set to `true`, if the test passes it will not register as pass, but you can use `--info/-i` on the CLI or inspect the `info` property on the response from the API to see it.
451
+
When the `optional` property is set to `true` on a test, a test will not count as either passed or failed, but the test will still be run and the result able to be inspected.
452
+
453
+
Optional tests do not count towards the total number of tests run, test passed or tests failed. They will show up in results in the Command Line Interface if they pass, but not if they fail; however passing optional tests appear differently to other tests in the results to make it clear they are optional checks.
415
454
416
-
The default is `false`. This option can be used in conjunction with `warning` if it should not be counted as a failed test if it does not pass.
455
+
You can use `--info/-i` on the CLI or inspect the `optional` property on the response from the API to see the result of any test that has `optional` property set on it. However, if an optional test fails because the property it was testing does not exist, it will not be displayed in the CLI. If a property is optional but recommended, use the `warning` option instead.
456
+
457
+
Note: Strictly speaking, in principle no specific properties on Schema.org objects are "required" but in practice implementations by vendors like Google have some "required" or expected properties and also respect some "optional" properties; this option is useful for writing tests that don't fail if a valid, but not necessarily required, property is not found.
458
+
459
+
The default is `false`.
417
460
418
461
#### conditional
419
462
```
@@ -424,10 +467,12 @@ Default: undefined
424
467
425
468
A `conditional` object can contain a conditional test to be run, to determine if the test itself should be run.
426
469
427
-
If the conditional test fails, the test will not be run (and it will not be included in the test results). If the conditional test passes, the test will be run and the pass / fail / info / warning included in the results.
470
+
If the conditional test fails, the test will not be run (and it will not be included in the test results). If the conditional test passes, the test will be run as it otherwise would be if the condition wasn't specified.
428
471
429
472
This is considered advanced usage, to help avoid having to write overly complex test statements. Conditional test objects use the same syntax as regular test objects, but conditional tests are not included in the results.
430
473
474
+
It is particularly useful for checking if it is appropriate to run a group of tests. For example, it is used by internal presets to check if a schema exists; if it does then all the tests for that schema are run (and required tests must pass), but if a schema does not exist then none of the tests for that schema are run.
0 commit comments