You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/JestObjectAPI.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -534,7 +534,7 @@ Registers a callback function that is invoked whenever Jest generates a mock for
534
534
535
535
Parameters for callback:
536
536
537
-
1.`moduleName: string` - The name of the module that is being mocked.
537
+
1.`modulePath: string` - The absolute path to the module that is being mocked.
538
538
2.`moduleMock: T` - The mock object that Jest has generated for the module. This object can be modified or replaced before returning.
539
539
540
540
Behaviour:
@@ -543,9 +543,9 @@ Behaviour:
543
543
- Each callback receives the output of the previous callback as its `moduleMock`. This makes it possible to apply multiple layers of transformations to the same mock.
544
544
545
545
```js
546
-
jest.onGenerateMock((moduleName, moduleMock) => {
546
+
jest.onGenerateMock((modulePath, moduleMock) => {
547
547
// Inspect the module name and decide how to transform the mock
548
-
if (moduleName.includes('Database')) {
548
+
if (modulePath.includes('Database')) {
549
549
// For demonstration, let's replace a method with our own custom mock
0 commit comments