chore(deps): upgrade jest to v30

Bump jest ^29.5.0 -> ^30.4.2, @types/jest ^29.5.14 -> ^30.0.0, and
ts-jest ^29.4.6 -> ^29.4.11.

@types/jest@30 removes the deprecated `toThrowError` matcher type, so
migrate every `.toThrowError()` assertion to `.toThrow()`.
This commit is contained in:
Damien Retzinger
2026-06-09 17:30:16 -04:00
parent 0a33911be4
commit 8a6a886d7e
14 changed files with 1596 additions and 889 deletions
+1551 -844
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -22,14 +22,14 @@
"@actions/exec": "^3.0.0" "@actions/exec": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^30.0.0",
"@types/node": "^24.10.4", "@types/node": "^24.10.4",
"@typescript-eslint/eslint-plugin": "^8.49.0", "@typescript-eslint/eslint-plugin": "^8.49.0",
"@typescript-eslint/parser": "^8.49.0", "@typescript-eslint/parser": "^8.49.0",
"esbuild": "^0.25.12", "esbuild": "^0.25.12",
"eslint": "^9.39.2", "eslint": "^9.39.2",
"jest": "^29.5.0", "jest": "^30.4.2",
"ts-jest": "^29.4.6", "ts-jest": "^29.4.11",
"typescript": "^5.9.3" "typescript": "^5.9.3"
} }
} }
+3 -3
View File
@@ -13,14 +13,14 @@ describe('isKind / assertKind', () => {
it('rejects other strings', () => { it('rejects other strings', () => {
expect(isKind('taco')).toBe(false); expect(isKind('taco')).toBe(false);
expect(() => assertKind('taco')).toThrowError(/`kind` must be 'store' or 'extension'/); expect(() => assertKind('taco')).toThrow(/`kind` must be 'store' or 'extension'/);
}); });
it('rejects empty input', () => { it('rejects empty input', () => {
expect(() => assertKind('')).toThrowError(/`kind` must be 'store' or 'extension'/); expect(() => assertKind('')).toThrow(/`kind` must be 'store' or 'extension'/);
}); });
it('rejects non-string input', () => { it('rejects non-string input', () => {
expect(() => assertKind(undefined)).toThrowError(/`kind` must be 'store' or 'extension'/); expect(() => assertKind(undefined)).toThrow(/`kind` must be 'store' or 'extension'/);
}); });
}); });
@@ -88,13 +88,13 @@ describe('resolveExtensionConfig', () => {
}); });
it('throws on a typo in the job name', () => { it('throws on a typo in the job name', () => {
expect(() => resolveExtensionConfig({ jobs: { 'inteegration_test': false } }, MATRIX)).toThrowError( expect(() => resolveExtensionConfig({ jobs: { 'inteegration_test': false } }, MATRIX)).toThrow(
/unknown job "inteegration_test" for kind "extension"/ /unknown job "inteegration_test" for kind "extension"/
); );
}); });
it('throws when a store-only job name is used', () => { it('throws when a store-only job name is used', () => {
expect(() => resolveExtensionConfig({ jobs: { 'smoke-test': false } }, MATRIX)).toThrowError( expect(() => resolveExtensionConfig({ jobs: { 'smoke-test': false } }, MATRIX)).toThrow(
/unknown job "smoke-test" for kind "extension"/ /unknown job "smoke-test" for kind "extension"/
); );
}); });
+3 -3
View File
@@ -103,19 +103,19 @@ describe('resolveStoreConfig', () => {
}); });
it('rejects probes on a job that does not support it', () => { it('rejects probes on a job that does not support it', () => {
expect(() => resolveStoreConfig({ jobs: { 'unit-test': { probes: ['page'] } } }, MATRIX)).toThrowError( expect(() => resolveStoreConfig({ jobs: { 'unit-test': { probes: ['page'] } } }, MATRIX)).toThrow(
/job "unit-test" does not support "probes"/ /job "unit-test" does not support "probes"/
); );
}); });
it('throws on a typo in the job name', () => { it('throws on a typo in the job name', () => {
expect(() => resolveStoreConfig({ jobs: { 'smkoe-test': false } }, MATRIX)).toThrowError( expect(() => resolveStoreConfig({ jobs: { 'smkoe-test': false } }, MATRIX)).toThrow(
/unknown job "smkoe-test" for kind "store"/ /unknown job "smkoe-test" for kind "store"/
); );
}); });
it('throws when an extension-only job name is used', () => { it('throws when an extension-only job name is used', () => {
expect(() => resolveStoreConfig({ jobs: { 'unit-test-extension': false } }, MATRIX)).toThrowError( expect(() => resolveStoreConfig({ jobs: { 'unit-test-extension': false } }, MATRIX)).toThrow(
/unknown job "unit-test-extension" for kind "store"/ /unknown job "unit-test-extension" for kind "store"/
); );
}); });
+18 -18
View File
@@ -78,23 +78,23 @@ describe('normalizeJobEntry', () => {
}); });
it('throws when entry is a non-array primitive other than boolean', () => { it('throws when entry is a non-array primitive other than boolean', () => {
expect(() => normalizeJobEntry('unit-test', 'true' as never, noDefaults)).toThrowError( expect(() => normalizeJobEntry('unit-test', 'true' as never, noDefaults)).toThrow(
/must be a boolean or an object/ /must be a boolean or an object/
); );
}); });
it('throws when entry is an array', () => { it('throws when entry is an array', () => {
expect(() => normalizeJobEntry('unit-test', [] as never, noDefaults)).toThrowError(/got array/); expect(() => normalizeJobEntry('unit-test', [] as never, noDefaults)).toThrow(/got array/);
}); });
it('throws when services is not an array', () => { it('throws when services is not an array', () => {
expect(() => normalizeJobEntry('smoke-test', { services: 'search' } as never, smokeDefaults)).toThrowError( expect(() => normalizeJobEntry('smoke-test', { services: 'search' } as never, smokeDefaults)).toThrow(
/services must be an array of tier names/ /services must be an array of tier names/
); );
}); });
it('throws when services contains an unknown tier', () => { it('throws when services contains an unknown tier', () => {
expect(() => normalizeJobEntry('smoke-test', { services: ['llm'] } as never, smokeDefaults)).toThrowError( expect(() => normalizeJobEntry('smoke-test', { services: ['llm'] } as never, smokeDefaults)).toThrow(
/services contains unknown tier "llm"/ /services contains unknown tier "llm"/
); );
}); });
@@ -138,19 +138,19 @@ describe('normalizeProbes', () => {
}); });
it('throws when probes is set on a job that does not support it', () => { it('throws when probes is set on a job that does not support it', () => {
expect(() => normalizeProbes('unit-test', ['page'], undefined)).toThrowError( expect(() => normalizeProbes('unit-test', ['page'], undefined)).toThrow(
/job "unit-test" does not support "probes"/ /job "unit-test" does not support "probes"/
); );
}); });
it('throws when probes is not an array', () => { it('throws when probes is not an array', () => {
expect(() => normalizeProbes('smoke-test', 'page', ['page'])).toThrowError( expect(() => normalizeProbes('smoke-test', 'page', ['page'])).toThrow(
/probes must be an array of probe names/ /probes must be an array of probe names/
); );
}); });
it('throws when probes contains an unknown probe', () => { it('throws when probes contains an unknown probe', () => {
expect(() => normalizeProbes('smoke-test', ['rest'], ['page'])).toThrowError( expect(() => normalizeProbes('smoke-test', ['rest'], ['page'])).toThrow(
/probes contains unknown probe "rest"/ /probes contains unknown probe "rest"/
); );
}); });
@@ -295,13 +295,13 @@ describe('resolveJobs', () => {
}); });
it('throws on unknown job names with the kind in the message', () => { it('throws on unknown job names with the kind in the message', () => {
expect(() => resolveJobs({ jobs: { taco: false } }, 'store', jobs, MATRIX)).toThrowError( expect(() => resolveJobs({ jobs: { taco: false } }, 'store', jobs, MATRIX)).toThrow(
/unknown job "taco" for kind "store"/ /unknown job "taco" for kind "store"/
); );
}); });
it('throws when `jobs` is not an object', () => { it('throws when `jobs` is not an object', () => {
expect(() => resolveJobs({ jobs: 'oops' } as never, 'store', jobs, MATRIX)).toThrowError( expect(() => resolveJobs({ jobs: 'oops' } as never, 'store', jobs, MATRIX)).toThrow(
/`jobs` must be an object/ /`jobs` must be an object/
); );
}); });
@@ -323,19 +323,19 @@ describe('parseRawConfig', () => {
}); });
it('throws on syntactically invalid JSON', () => { it('throws on syntactically invalid JSON', () => {
expect(() => parseRawConfig('{not json}')).toThrowError(/failed to parse JSON/); expect(() => parseRawConfig('{not json}')).toThrow(/failed to parse JSON/);
}); });
it('throws when top level is an array', () => { it('throws when top level is an array', () => {
expect(() => parseRawConfig('[]')).toThrowError(/top-level value must be an object/); expect(() => parseRawConfig('[]')).toThrow(/top-level value must be an object/);
}); });
it('throws when top level is a primitive', () => { it('throws when top level is a primitive', () => {
expect(() => parseRawConfig('"hello"')).toThrowError(/top-level value must be an object/); expect(() => parseRawConfig('"hello"')).toThrow(/top-level value must be an object/);
}); });
it('throws when top level is null', () => { it('throws when top level is null', () => {
expect(() => parseRawConfig('null')).toThrowError(/top-level value must be an object/); expect(() => parseRawConfig('null')).toThrow(/top-level value must be an object/);
}); });
}); });
@@ -346,22 +346,22 @@ describe('parseMatrixInput', () => {
}); });
it('throws on empty input', () => { it('throws on empty input', () => {
expect(() => parseMatrixInput('')).toThrowError(/`matrix` input is required/); expect(() => parseMatrixInput('')).toThrow(/`matrix` input is required/);
}); });
it('throws on invalid JSON', () => { it('throws on invalid JSON', () => {
expect(() => parseMatrixInput('{nope}')).toThrowError(/failed to parse `matrix` input/); expect(() => parseMatrixInput('{nope}')).toThrow(/failed to parse `matrix` input/);
}); });
it('throws when top level is an array', () => { it('throws when top level is an array', () => {
expect(() => parseMatrixInput('[]')).toThrowError(/`matrix` must be a JSON object/); expect(() => parseMatrixInput('[]')).toThrow(/`matrix` must be a JSON object/);
}); });
it('throws when include is missing', () => { it('throws when include is missing', () => {
expect(() => parseMatrixInput('{}')).toThrowError(/`matrix.include` must be an array/); expect(() => parseMatrixInput('{}')).toThrow(/`matrix.include` must be an array/);
}); });
it('throws when include is not an array', () => { it('throws when include is not an array', () => {
expect(() => parseMatrixInput('{"include": "nope"}')).toThrowError(/`matrix.include` must be an array/); expect(() => parseMatrixInput('{"include": "nope"}')).toThrow(/`matrix.include` must be an array/);
}); });
}); });
+2 -2
View File
@@ -29,10 +29,10 @@ describe('resolveConfig', () => {
}); });
it('rejects a job name from the other kind', () => { it('rejects a job name from the other kind', () => {
expect(() => resolveConfig({ jobs: { 'smoke-test': false } }, 'extension', MATRIX)).toThrowError( expect(() => resolveConfig({ jobs: { 'smoke-test': false } }, 'extension', MATRIX)).toThrow(
/unknown job "smoke-test" for kind "extension"/ /unknown job "smoke-test" for kind "extension"/
); );
expect(() => resolveConfig({ jobs: { 'unit-test-extension': false } }, 'store', MATRIX)).toThrowError( expect(() => resolveConfig({ jobs: { 'unit-test-extension': false } }, 'store', MATRIX)).toThrow(
/unknown job "unit-test-extension" for kind "store"/ /unknown job "unit-test-extension" for kind "store"/
); );
}); });
@@ -6,11 +6,11 @@ describe('validateKind', () => {
}); });
it('throws a helpful exception if its an invalid kind', () => { it('throws a helpful exception if its an invalid kind', () => {
expect(() => validateKind(<any>"taco")).toThrowError(); expect(() => validateKind(<any>"taco")).toThrow();
}) })
it('throws a helpful exception if custom versions are provided with the wrong kind', () => { it('throws a helpful exception if custom versions are provided with the wrong kind', () => {
expect(() => validateKind(<any>"latest", [])).toThrowError(); expect(() => validateKind(<any>"latest", [])).toThrow();
}) })
it('returns `true` for kind `custom` with a custom versions', () => { it('returns `true` for kind `custom` with a custom versions', () => {
@@ -62,7 +62,7 @@ describe('getMatrixForKind for mage-os', () => {
}); });
it('errors for invalid `custom``', () => { it('errors for invalid `custom``', () => {
expect(() => getMatrixForKind("custom", project)).toThrowError(); expect(() => getMatrixForKind("custom", project)).toThrow();
}); });
}) })
@@ -133,6 +133,6 @@ describe('getMatrixForKind for magento-open-source', () => {
}); });
it('errors for invalid `custom``', () => { it('errors for invalid `custom``', () => {
expect(() => getMatrixForKind("custom", project)).toThrowError(); expect(() => getMatrixForKind("custom", project)).toThrow();
}); });
}) })
@@ -8,6 +8,6 @@ describe('validateProject', () => {
}); });
it('throws a helpful exception if it is an invalid project', () => { it('throws a helpful exception if it is an invalid project', () => {
expect(() => validateProject(<any>"quark")).toThrowError(); expect(() => validateProject(<any>"quark")).toThrow();
}) })
}) })
@@ -9,6 +9,6 @@ describe('isKnownProject', () => {
}); });
it('throws a message if for unknown projects', () => { it('throws a message if for unknown projects', () => {
expect(() => isKnownProject(<Project>"bingo")).toThrowError() expect(() => isKnownProject(<Project>"bingo")).toThrow()
}); });
}) })
@@ -35,16 +35,16 @@ describe('parseServicePreferences', () => {
}); });
it('throws on unknown service name', () => { it('throws on unknown service name', () => {
expect(() => parseServicePreferences('foobar')).toThrowError(/unknown service "foobar"/); expect(() => parseServicePreferences('foobar')).toThrow(/unknown service "foobar"/);
}); });
it('throws on a collision in the search tier', () => { it('throws on a collision in the search tier', () => {
expect(() => parseServicePreferences('elasticsearch,opensearch')).toThrowError( expect(() => parseServicePreferences('elasticsearch,opensearch')).toThrow(
/collision in tier "search"/ /collision in tier "search"/
); );
}); });
it('throws on a collision in the cache tier', () => { it('throws on a collision in the cache tier', () => {
expect(() => parseServicePreferences('redis,valkey')).toThrowError(/collision in tier "cache"/); expect(() => parseServicePreferences('redis,valkey')).toThrow(/collision in tier "cache"/);
}); });
}); });
@@ -31,7 +31,7 @@ describe('validatePreferencesAgainstMatrix', () => {
baseEntry({ version: '2.4.7' }), baseEntry({ version: '2.4.7' }),
baseEntry({ version: '2.4.5', opensearch: '' }), baseEntry({ version: '2.4.5', opensearch: '' }),
]; ];
expect(() => validatePreferencesAgainstMatrix({ search: 'opensearch' }, entries)).toThrowError( expect(() => validatePreferencesAgainstMatrix({ search: 'opensearch' }, entries)).toThrow(
/not satisfied for:\n\s+- magento 2\.4\.5 \(supported: elasticsearch\)/ /not satisfied for:\n\s+- magento 2\.4\.5 \(supported: elasticsearch\)/
); );
}); });
@@ -41,14 +41,14 @@ describe('validatePreferencesAgainstMatrix', () => {
baseEntry({ version: '2.4.5', opensearch: '' }), baseEntry({ version: '2.4.5', opensearch: '' }),
baseEntry({ version: '2.4.4', opensearch: '' }), baseEntry({ version: '2.4.4', opensearch: '' }),
]; ];
expect(() => validatePreferencesAgainstMatrix({ search: 'opensearch' }, entries)).toThrowError( expect(() => validatePreferencesAgainstMatrix({ search: 'opensearch' }, entries)).toThrow(
/magento 2\.4\.5[\s\S]*magento 2\.4\.4/ /magento 2\.4\.5[\s\S]*magento 2\.4\.4/
); );
}); });
it('reports "<none>" when the entry supports nothing in the tier', () => { it('reports "<none>" when the entry supports nothing in the tier', () => {
const entries = [baseEntry({ version: '2.4.0', opensearch: '', elasticsearch: '' })]; const entries = [baseEntry({ version: '2.4.0', opensearch: '', elasticsearch: '' })];
expect(() => validatePreferencesAgainstMatrix({ search: 'opensearch' }, entries)).toThrowError( expect(() => validatePreferencesAgainstMatrix({ search: 'opensearch' }, entries)).toThrow(
/magento 2\.4\.0 \(supported: <none>\)/ /magento 2\.4\.0 \(supported: <none>\)/
); );
}); });
@@ -9,7 +9,7 @@ describe('getIndividialVersionsForProject', () => {
}) })
it('throws error if no individual versions are specified for given project', () => { it('throws error if no individual versions are specified for given project', () => {
expect(() => getIndividualVersionsForProject(<Project>"ahsoka")).toThrowError() expect(() => getIndividualVersionsForProject(<Project>"ahsoka")).toThrow()
}) })
}) })
@@ -21,6 +21,6 @@ describe('getCompositeVersionsForProject', () => {
}) })
it('throws error if no composite versions are specified for given project', () => { it('throws error if no composite versions are specified for given project', () => {
expect(() => getCompositeVersionsForProject(<Project>"spock")).toThrowError() expect(() => getCompositeVersionsForProject(<Project>"spock")).toThrow()
}) })
}) })