|
| 1 | +/** |
| 2 | + * This next version of JSON Schema Form ("V2") |
| 3 | + * must be tested against 2 sets ("root") of tests. |
| 4 | + * Note that "rootDir" is the path to this next version. |
| 5 | + * |
| 6 | + * @type {import('jest').Config['roots']} |
| 7 | + */ |
| 8 | +const roots = [ |
| 9 | + // 1. The existing tests from the previous version ("V1") |
| 10 | + '<rootDir>/../src/tests', |
| 11 | + // 2. The new tests for this version |
| 12 | + '<rootDir>/test', |
| 13 | +] |
| 14 | + |
| 15 | +/** |
| 16 | + * Module aliases to use the same test with different source versions. |
| 17 | + * To learn more, see "roots" above. |
| 18 | + * |
| 19 | + * This is only needed to use V1 tests for V2 source. |
| 20 | + * as V2 tests are used to test V2 source only. |
| 21 | + * |
| 22 | + * @type {import('jest').Config['moduleNameMapper']} |
| 23 | + */ |
| 24 | +const moduleNameMapper = { |
| 25 | + // We use kebab-case in V2 |
| 26 | + '^@/createHeadlessForm$': '<rootDir>/src/form', |
| 27 | + '^@/utils$': '<rootDir>/src/utils', |
| 28 | + // Avoid catch all aliases such as "^@/(.*)$". |
| 29 | + // Aliases should be added as needed. |
| 30 | + // If there are many, we will have a compat barrel file. |
| 31 | +} |
| 32 | + |
| 33 | +/** |
| 34 | + * Some tests are invalid for V2 testing. |
| 35 | + * For example: |
| 36 | + * - Buggy behaviours in V1 that are already fixed (and tested) in V2 |
| 37 | + * - Deprecated or removed APIs |
| 38 | + * |
| 39 | + * @type {import('jest').Config['testPathIgnorePatterns']} |
| 40 | + */ |
| 41 | +const testPathIgnorePatterns = [ |
| 42 | + // Nothing yet |
| 43 | +] |
| 44 | + |
| 45 | +/** @type {import('jest').Config} */ |
| 46 | +const config = { |
| 47 | + roots, |
| 48 | + moduleNameMapper, |
| 49 | + testPathIgnorePatterns, |
| 50 | +} |
| 51 | + |
| 52 | +export default config |
0 commit comments