Skip to content

Commit 8a6e44e

Browse files
committed
Update jest to v30
1 parent 220b248 commit 8a6e44e

13 files changed

Lines changed: 1077 additions & 747 deletions

File tree

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,20 @@
4646
"devDependencies": {
4747
"@eslint/compat": "^2.0.0",
4848
"@eslint/js": "^9.0.0",
49-
"@jest/globals": "^29.0.0",
49+
"@jest/globals": "^30.0.0",
5050
"@types/node": "^22.0.0",
5151
"@types/yargs-parser": "^21.0.0",
5252
"@typescript-eslint/utils": "^8.52.0",
5353
"depcheck": "^1.4.7",
5454
"eslint": "^9.0.0",
5555
"eslint-config-prettier": "^10.1.8",
5656
"husky": "^9.0.0",
57-
"jest": "^29.0.0",
57+
"jest": "^30.0.0",
5858
"lage": "^2.15.0",
5959
"lint-staged": "^16.0.0",
6060
"prettier": "~2.8.4",
6161
"syncpack": "^9.0.0",
62-
"ts-jest": "29.2.6",
62+
"ts-jest": "^29.4.0",
6363
"typescript": "~6.0.0",
6464
"typescript-eslint": "^8.52.0"
6565
},
@@ -74,9 +74,6 @@
7474
"@verdaccio/core/ajv@8.18.0": "^8.18.0"
7575
},
7676
"rationale": {
77-
"devDependencies": {
78-
"ts-jest@29.2.6": "29.3.0 introduces type-fest v4 which requires node 16+"
79-
},
8077
"resolutions": {
8178
"lodash": "Unpin due to security issue",
8279
"*/qs": "Unpin due to security issue",

packages/beachball/src/__fixtures__/mockNpm.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
_mockNpmPublish,
1515
_mockNpmShow,
1616
type MockNpmResult,
17+
type MockNpmCommand,
1718
} from './mockNpm';
1819
import * as readJsonModule from '../object/readJson';
1920

@@ -505,15 +506,15 @@ describe('mockNpm', () => {
505506
const fakePublishResult = 'hi';
506507

507508
it('respects mocked command override', async () => {
508-
const mockPublish = jest.fn(() => Promise.resolve(fakePublishResult as unknown as MockNpmResult));
509+
const mockPublish = jest.fn<MockNpmCommand>(() => Promise.resolve(fakePublishResult as unknown as MockNpmResult));
509510
npmMock.setCommandOverride('publish', mockPublish);
510511
const result = await npm(['publish', 'foo'], { cwd: '' });
511512
expect(result).toEqual(fakePublishResult);
512513
expect(mockPublish).toHaveBeenCalledWith(expect.any(Object), ['foo'], { cwd: '' });
513514
});
514515

515516
it("respects extra mocked command that's not normally supported", async () => {
516-
const mockFoo = jest.fn(() => Promise.resolve('hi' as unknown as MockNpmResult));
517+
const mockFoo = jest.fn<MockNpmCommand>(() => Promise.resolve('hi' as unknown as MockNpmResult));
517518
npmMock.setCommandOverride('foo', mockFoo);
518519
const result = await npm(['foo'], { cwd: '' });
519520
expect(result).toEqual('hi');

packages/beachball/src/__functional__/changelog/__snapshots__/writeChangelog.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`writeChangelog generates basic changelog: changelog md 1`] = `
44
"# Change Log - foo

packages/beachball/src/__functional__/commands/__snapshots__/publish.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`publish command logs expected output for a standard publish flow 1`] = `
44
"[log]

packages/beachball/src/__functional__/publish/__snapshots__/publishToRegistry.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`publishToRegistry includes new packages not modified 1`] = `
44
"[log] Validating new package versions...

packages/beachball/src/__functional__/publish/publishToRegistry.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ describe('publishToRegistry', () => {
249249
const fooPath = expect.stringMatching(/packages[\\/]foo$/);
250250
// BUG: this should use the old version 1.0.0, not the new one
251251
// https://github.com/microsoft/beachball/issues/1116
252-
expect(prebump).toHaveBeenCalledWith(fooPath, 'foo', '1.0.1', expect.anything());
252+
expect(prebump as typeof postbump).toHaveBeenCalledWith(fooPath, 'foo', '1.0.1', expect.anything());
253253
// this is correct
254254
expect(postbump).toHaveBeenCalledWith(fooPath, 'foo', '1.0.1', expect.anything());
255255
});

packages/beachball/src/__tests__/changelog/__snapshots__/renderChangelog.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`renderChangelog handles no previous content 1`] = `
44
"# Change Log - foo

packages/beachball/src/__tests__/changelog/__snapshots__/renderPackageChangelog.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`changelog renderers - renderPackageChangelog has correct grouped output 1`] = `
44
"## 1.2.3

packages/beachball/src/__tests__/publish/__snapshots__/bumpAndPush.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`bumpAndPush retries on fetch failure then succeeds 2`] = `
44
"[log] --------------------------------------------------------------------------------

packages/beachball/src/__tests__/publish/tagPackages.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jest.mock('workspace-tools', () => ({
1111
const gitFailFast = _gitFailFast as jest.MockedFunction<typeof _gitFailFast>;
1212

1313
const createTagParameters = (tag: string) => {
14-
return [['tag', '-a', '-f', tag, '-m', tag], { cwd: '' }];
14+
return [['tag', '-a', '-f', tag, '-m', tag], { cwd: '' }] as [string[], { cwd: string }];
1515
};
1616

1717
type TagBumpInfo = Parameters<typeof tagPackages>[0];
@@ -136,7 +136,7 @@ describe('tagPackages', () => {
136136

137137
it('creates overall git tag for non-"latest" dist tag', () => {
138138
tagPackages(emptyBumpInfo, { path: '', gitTags: true, tag: 'abc' });
139-
expect(gitFailFast).toBeCalledTimes(1);
139+
expect(gitFailFast).toHaveBeenCalledTimes(1);
140140
expect(gitFailFast).toHaveBeenCalledWith(...createTagParameters('abc'));
141141
});
142142
});

0 commit comments

Comments
 (0)