-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(transformer): add deepUnmock to hoist method list (#1372)
* fix(transformers): add deepUnmock to hoist methods * fix(transformers): add deepUnmock to hoist methods
- Loading branch information
Showing
11 changed files
with
644 additions
and
217 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
e2e/__cases__/hoisting/disable-automock/disable-automock.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import hello from './disable-automock' | ||
|
||
jest.disableAutomock() | ||
|
||
test('original implementation', () => { | ||
// now we have the original implementation, | ||
// even if we set the automocking in a jest configuration | ||
expect(hello()).toBe('hi!') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function() { | ||
return 'hi!' | ||
} |
9 changes: 9 additions & 0 deletions
9
e2e/__cases__/hoisting/enable-automock/enable-automock.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
jest.enableAutomock() | ||
|
||
import hello from './enable-automock' | ||
|
||
test('original implementation', () => { | ||
// now we have the mocked implementation, | ||
// @ts-ignore | ||
expect(hello._isMockFunction).toBeTruthy() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function() { | ||
return 'hi!' | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import hello from './mock-unmock' | ||
|
||
jest.mock('./mock-unmock') | ||
|
||
const original = jest.requireActual('./mock-unmock').default | ||
it('should have been mocked', () => { | ||
const msg = hello() | ||
expect(hello).not.toBe(original) | ||
expect(msg).toBeUndefined() | ||
expect(hello).toHaveProperty('mock') | ||
expect(require('foo')).toBe('bar') | ||
jest.mock('foo', () => 'bar', { virtual: true }) | ||
}) |
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters