@@ -6,6 +6,8 @@ import * as hoist from './hoist-jest'
66const CODE_WITH_HOISTING = `
77const foo = 'foo'
88console.log(foo)
9+ jest.enableAutomock()
10+ jest.disableAutomock()
911jest.mock('./foo')
1012jest.mock('./foo/bar', () => 'bar')
1113const func = () => {
@@ -42,27 +44,29 @@ describe('hoisting', () => {
4244 it ( 'should hoist jest mock() and unmock() statements' , ( ) => {
4345 const out = transpile ( CODE_WITH_HOISTING )
4446 expect ( out . outputText ) . toMatchInlineSnapshot ( `
45- "jest.mock('./foo');
46- jest.mock('./foo/bar', function () { return 'bar'; });
47- var foo = 'foo';
48- console.log(foo);
49- var func = function () {
50- jest.unmock('./foo');
51- jest.mock('./bar');
52- jest.mock('./bar/foo', function () { return 'foo'; });
53- jest.unmock('./foo/bar');
54- var bar = 'bar';
55- console.log(bar);
56- };
57- var func2 = function () {
58- jest.mock('./bar');
59- jest.unmock('./foo/bar');
60- jest.mock('./bar/foo', function () { return 'foo'; });
61- jest.unmock('./foo');
62- var bar = 'bar';
63- console.log(bar);
64- };
65- "
66- ` )
47+ "jest.enableAutomock();
48+ jest.disableAutomock();
49+ jest.mock('./foo');
50+ jest.mock('./foo/bar', function () { return 'bar'; });
51+ var foo = 'foo';
52+ console.log(foo);
53+ var func = function () {
54+ jest.unmock('./foo');
55+ jest.mock('./bar');
56+ jest.mock('./bar/foo', function () { return 'foo'; });
57+ jest.unmock('./foo/bar');
58+ var bar = 'bar';
59+ console.log(bar);
60+ };
61+ var func2 = function () {
62+ jest.mock('./bar');
63+ jest.unmock('./foo/bar');
64+ jest.mock('./bar/foo', function () { return 'foo'; });
65+ jest.unmock('./foo');
66+ var bar = 'bar';
67+ console.log(bar);
68+ };
69+ "
70+ ` )
6771 } )
6872} )
0 commit comments