()
| 670 | } |
| 671 | |
| 672 | async function taskCheck() { |
| 673 | console.info(`===== VALIDATE PRECONDITIONS =====`) |
| 674 | await assertFileSystemIsValid() |
| 675 | |
| 676 | // Check catalog.json. |
| 677 | await assertFileValidatesAgainstSchema( |
| 678 | CatalogFile, |
| 679 | path.join(SchemaDir, 'schema-catalog.json'), |
| 680 | ) |
| 681 | await assertFilePassesJsonLint(await toFile(CatalogFile)) |
| 682 | assertCatalogJsonHasNoDuplicateNames() |
| 683 | assertCatalogJsonHasNoBadFields() |
| 684 | assertCatalogJsonHasNoFileMatchConflict() |
| 685 | await assertCatalogJsonLocalURLsAreOneToOne() |
| 686 | |
| 687 | // Check schema-validation.jsonc. |
| 688 | await assertFileValidatesAgainstSchema( |
| 689 | SchemaValidationFile, |
| 690 | 'src/schema-validation.schema.json', |
| 691 | ) |
| 692 | await assertFilePassesJsonLint(await toFile(SchemaValidationFile), { |
| 693 | ignoreComments: true, |
| 694 | }) |
| 695 | await assertSchemaValidationJsonReferencesNoNonexistentFiles() |
| 696 | assertSchemaValidationJsonHasValidSkipTest() |
| 697 | |
| 698 | // Run pre-checks (checks before JSON Schema validation) on all files |
| 699 | console.info(`===== VALIDATE SCHEMAS =====`) |
| 700 | await forEachFile({ |
| 701 | actionName: 'pre-checks', |
| 702 | async onSchemaFile(schema) { |
| 703 | assertFileHasNoBom(schema) |
| 704 | assertFileHasCorrectExtensions(schema.path, ['.json']) |
| 705 | await assertFilePassesJsonLint(schema) |
| 706 | await assertSchemaHasValidIdField(schema) |
| 707 | await assertSchemaHasValidSchemaField(schema) |
| 708 | }, |
| 709 | async onPositiveTestFile(schema, testFile, _data, { spinner }) { |
| 710 | assertFileHasNoBom(testFile) |
| 711 | assertFileHasCorrectExtensions(testFile.path, [ |
| 712 | '.json', |
| 713 | '.yaml', |
| 714 | '.yml', |
| 715 | '.toml', |
| 716 | ]) |
| 717 | await assertTestFileHasSchemaPragma(schema, testFile, spinner) |
| 718 | if (testFile.path.endsWith('.json')) { |
| 719 | await assertFilePassesJsonLint(testFile) |
| 720 | } |
| 721 | }, |
| 722 | async onNegativeTestFile(schema, testFile, _data, { spinner }) { |
| 723 | assertFileHasNoBom(testFile) |
| 724 | assertFileHasCorrectExtensions(testFile.path, [ |
| 725 | '.json', |
| 726 | '.yaml', |
| 727 | '.yml', |
| 728 | '.toml', |
| 729 | ]) |
nothing calls this directly
no test coverage detected