()
| 1610 | } |
| 1611 | |
| 1612 | function assertSchemaValidationJsonHasValidSkipTest() { |
| 1613 | const check = ( |
| 1614 | /** @type {string[]} */ schemaNames, |
| 1615 | /** @type {string} */ propertyName, |
| 1616 | ) => { |
| 1617 | for (const schemaName of schemaNames) { |
| 1618 | if (SchemaValidation.skiptest.includes(schemaName)) { |
| 1619 | printErrorAndExit(new Error(), [ |
| 1620 | `Did not expect to find filename "${schemaName}" in file "${SchemaValidationFile}" under property "${propertyName}[]"`, |
| 1621 | `Because filename "${schemaName}" is listed under "skiptest", it should not be referenced anywhere else in the file`, |
| 1622 | ]) |
| 1623 | } |
| 1624 | } |
| 1625 | } |
| 1626 | |
| 1627 | check(SchemaValidation.ajvNotStrictMode, 'ajvNotStrictMode') |
| 1628 | check(SchemaValidation.missingCatalogUrl, 'missingCatalogUrl') |
| 1629 | check(SchemaValidation.highSchemaVersion, 'highSchemaVersion') |
| 1630 | |
| 1631 | for (const schemaName in SchemaValidation.options) { |
| 1632 | if (SchemaValidation.skiptest.includes(schemaName)) { |
| 1633 | printErrorAndExit(new Error(), [ |
| 1634 | `Did not expect to find filename "${schemaName}" in file "${SchemaValidationFile}" under property "options"`, |
| 1635 | `Because filename "${schemaName}" is listed under "skiptest", it should not be referenced anywhere else in the file`, |
| 1636 | ]) |
| 1637 | } |
| 1638 | } |
| 1639 | |
| 1640 | // Test folder must not exist if defined in skiptest[] |
| 1641 | for (const schemaName of SchemaValidation.skiptest) { |
| 1642 | const folderName = schemaName.replace(/\.json$/, '') |
| 1643 | |
| 1644 | const allowedExtraneousDirs = ['circleciconfig'] // TODO: Remove this |
| 1645 | |
| 1646 | if ( |
| 1647 | FoldersPositiveTest.includes(folderName) && |
| 1648 | !allowedExtraneousDirs.includes(folderName) |
| 1649 | ) { |
| 1650 | printErrorAndExit(new Error(), [ |
| 1651 | `Did not expect to find positive test directory at "./${path.join(TestPositiveDir, folderName)}"`, |
| 1652 | `Because filename "${schemaName}" is listed under "skiptest", it should not have any positive test files`, |
| 1653 | ]) |
| 1654 | } |
| 1655 | |
| 1656 | if ( |
| 1657 | FoldersNegativeTest.includes(folderName) && |
| 1658 | !allowedExtraneousDirs.includes(folderName) |
| 1659 | ) { |
| 1660 | printErrorAndExit(new Error(), [ |
| 1661 | `Did not expect to find negative test directory at "./${path.join(TestNegativeDir, folderName)}"`, |
| 1662 | `Because filename "${schemaName}" is listed under "skiptest", it should not have any negative test files`, |
| 1663 | ]) |
| 1664 | } |
| 1665 | } |
| 1666 | |
| 1667 | console.info(`✔️ schema-validation.jsonc has no invalid skiptest[] entries`) |
| 1668 | } |
| 1669 |
no test coverage detected