Skip to content

Commit 826f57f

Browse files
iclantonclaude
andauthored
[heft-jest-plugin] Migrate from @types/heft-jest to @types/jest (#5772)
* [heft-jest-plugin] Migrate from @types/heft-jest to @types/jest Replace the custom @types/heft-jest type shim with the official @types/jest package across all projects. Also removes the jest-global-setup.ts workaround that injected mocked() as a global — Jest 30 ships jest.mocked() as the standard API, so the global shim is no longer appropriate. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fixup! [heft-jest-plugin] Migrate from @types/heft-jest to @types/jest * Fix `mocked` references. * Include es2015.symbol.wellknown. * fixup! Include es2015.symbol.wellknown. --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f022484 commit 826f57f

89 files changed

Lines changed: 315 additions & 210 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/api-extractor/src/api/test/test-data/config-lookup1/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"experimentalDecorators": true,
1515
"strictNullChecks": true,
1616
"noUnusedLocals": true,
17-
"types": ["heft-jest", "node"],
17+
"types": ["jest", "node"],
1818

1919
"module": "commonjs",
2020
"target": "es2017",

apps/api-extractor/src/api/test/test-data/config-lookup2/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"experimentalDecorators": true,
1515
"strictNullChecks": true,
1616
"noUnusedLocals": true,
17-
"types": ["heft-jest", "node"],
17+
"types": ["jest", "node"],
1818

1919
"module": "commonjs",
2020
"target": "es2017",

apps/api-extractor/src/api/test/test-data/config-lookup3/src/test/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"experimentalDecorators": true,
1515
"strictNullChecks": true,
1616
"noUnusedLocals": true,
17-
"types": ["heft-jest", "node"],
17+
"types": ["jest", "node"],
1818

1919
"module": "commonjs",
2020
"target": "es2017",

apps/api-extractor/src/api/test/test-data/config-lookup3/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"experimentalDecorators": true,
1515
"strictNullChecks": true,
1616
"noUnusedLocals": true,
17-
"types": ["heft-jest", "node"],
17+
"types": ["jest", "node"],
1818

1919
"module": "commonjs",
2020
"target": "es2017",

apps/api-extractor/src/api/test/test-data/custom-tsdoc-tags/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"experimentalDecorators": true,
1515
"strictNullChecks": true,
1616
"noUnusedLocals": true,
17-
"types": ["heft-jest", "node"],
17+
"types": ["jest", "node"],
1818

1919
"module": "commonjs",
2020
"target": "es2017",

apps/rush/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"@rushstack/rush-amazon-s3-build-cache-plugin": "workspace:*",
4949
"@rushstack/rush-azure-storage-build-cache-plugin": "workspace:*",
5050
"@rushstack/rush-http-build-cache-plugin": "workspace:*",
51-
"@types/heft-jest": "1.0.1",
5251
"@types/semver": "7.5.0"
5352
},
5453
"exports": {

build-tests-samples/heft-node-basic-tutorial/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@rushstack/heft-jest-plugin": "workspace:*",
1616
"@rushstack/heft-lint-plugin": "workspace:*",
1717
"@rushstack/heft-typescript-plugin": "workspace:*",
18-
"@types/heft-jest": "1.0.1",
18+
"@types/jest": "30.0.0",
1919
"@types/node": "20.17.19",
2020
"eslint": "~9.37.0",
2121
"local-eslint-config": "workspace:*",

build-tests-samples/heft-node-basic-tutorial/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"noEmitOnError": false,
1919
"allowUnreachableCode": false,
2020

21-
"types": ["heft-jest", "node"],
21+
"types": ["jest", "node"],
2222

2323
"module": "commonjs",
2424
"target": "es2017",

build-tests-samples/heft-node-jest-tutorial/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@rushstack/heft-jest-plugin": "workspace:*",
1515
"@rushstack/heft-lint-plugin": "workspace:*",
1616
"@rushstack/heft-typescript-plugin": "workspace:*",
17-
"@types/heft-jest": "1.0.1",
17+
"@types/jest": "30.0.0",
1818
"@types/node": "20.17.19",
1919
"eslint": "~9.37.0",
2020
"local-eslint-config": "workspace:*",

build-tests-samples/heft-node-jest-tutorial/src/guide/01-automatic-mock.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { SoundPlayerConsumer } from './SoundPlayerConsumer';
1111

1212
beforeEach(() => {
1313
// Clear all instances and calls to constructor and all methods:
14-
mocked(SoundPlayer).mockClear();
14+
jest.mocked(SoundPlayer).mockClear();
1515
});
1616

1717
it('We can check if the consumer called the class constructor', () => {
@@ -31,9 +31,9 @@ it('We can check if the consumer called a method on the class instance', () => {
3131
soundPlayerConsumer.playSomethingCool();
3232

3333
// mock.instances is available with automatic mocks:
34-
const mockSoundPlayerInstance: SoundPlayer = mocked(SoundPlayer).mock.instances[0];
34+
const mockSoundPlayerInstance: SoundPlayer = jest.mocked(SoundPlayer).mock.instances[0];
3535

36-
const mockPlaySoundFile = mocked(mockSoundPlayerInstance.playSoundFile);
36+
const mockPlaySoundFile = jest.mocked(mockSoundPlayerInstance.playSoundFile);
3737
expect(mockPlaySoundFile.mock.calls[0][0]).toEqual(coolSoundFileName);
3838

3939
// Equivalent to above check:

0 commit comments

Comments
 (0)