1
1
// Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
3
- exports [` babel-plugin-jest-hoist TS typeof usage in jest.mock: TS typeof usage in jest.mock 1` ] = `
4
-
5
- jest.mock('some-module', () => {
6
- const actual = jest .requireActual (' some-module' );
7
-
8
- return jest .fn <typeof actual .method >();
9
- } );
10
-
11
- ↓ ↓ ↓ ↓ ↓ ↓
12
-
13
- _getJestObj().mock('some-module', () => {
14
- const actual = jest .requireActual (' some-module' );
15
- return jest .fn ();
16
- } );
17
- function _getJestObj() {
18
- const {jest } = require (' @jest/globals' );
19
- _getJestObj = () => jest ;
20
- return jest ;
21
- }
22
-
23
-
24
- ` ;
25
-
26
- exports [` babel-plugin-jest-hoist automatic react runtime: automatic react runtime 1` ] = `
3
+ exports [` babel-plugin-jest-hoist 1. automatic react runtime: 1. automatic react runtime 1` ] = `
27
4
28
5
jest.mock('./App', () => () => <div >Hello world</div >);
29
6
7
+
30
8
↓ ↓ ↓ ↓ ↓ ↓
31
9
32
10
var _jsxFileName = '/root/project/src/file.js';
@@ -55,60 +33,98 @@ function _getJestObj() {
55
33
return jest ;
56
34
}
57
35
36
+ ` ;
37
+
38
+ exports [` babel-plugin-jest-hoist 2. top level mocking: 2. top level mocking 1` ] = `
39
+
40
+ require('x');
41
+
42
+ jest.enableAutomock();
43
+ jest.disableAutomock();
44
+
45
+
46
+ ↓ ↓ ↓ ↓ ↓ ↓
47
+
48
+ _getJestObj().enableAutomock();
49
+ _getJestObj().disableAutomock();
50
+ function _getJestObj() {
51
+ const {jest } = require (' @jest/globals' );
52
+ _getJestObj = () => jest ;
53
+ return jest ;
54
+ }
55
+ require('x');
58
56
59
57
` ;
60
58
61
- exports [` babel-plugin-jest-hoist global jest.mock within jest.mock: global jest.mock within jest.mock 1` ] = `
59
+ exports [` babel-plugin-jest-hoist 3. within a block: 3. within a block 1` ] = `
62
60
63
- jest.mock('some-module', () => {
64
- jest .mock (' some-module' );
61
+ beforeEach(() => {
62
+ require (' x' );
63
+ jest .mock (' someNode' );
65
64
} );
66
65
66
+
67
67
↓ ↓ ↓ ↓ ↓ ↓
68
68
69
- _getJestObj().mock('some-module', () => {
70
- _getJestObj ().mock (' some-module' );
71
- } );
72
69
function _getJestObj() {
73
70
const {jest } = require (' @jest/globals' );
74
71
_getJestObj = () => jest ;
75
72
return jest ;
76
73
}
77
-
74
+ beforeEach(() => {
75
+ _getJestObj ().mock (' someNode' );
76
+ require (' x' );
77
+ } );
78
78
79
79
` ;
80
80
81
- exports [` babel-plugin-jest-hoist global jest.requireActual in jest.mock: global jest.requireActual in jest.mock 1` ] = `
81
+ exports [` babel-plugin-jest-hoist 4. within a block with no siblings: 4. within a block with no siblings 1` ] = `
82
82
83
- jest.mock('some-module', () => {
84
- jest .requireActual ( ' some-module ' );
83
+ beforeEach( () => {
84
+ jest .mock ( ' someNode ' );
85
85
} );
86
86
87
- jest.requireActual('some-module');
88
87
89
88
↓ ↓ ↓ ↓ ↓ ↓
90
89
91
- _getJestObj().mock('some-module', () => {
92
- _getJestObj ().requireActual (' some-module' );
93
- } );
94
90
function _getJestObj() {
95
91
const {jest } = require (' @jest/globals' );
96
92
_getJestObj = () => jest ;
97
93
return jest ;
98
94
}
99
- jest.requireActual('some-module');
95
+ beforeEach(() => {
96
+ _getJestObj ().mock (' someNode' );
97
+ } );
98
+
99
+ ` ;
100
+
101
+ exports [` babel-plugin-jest-hoist 5. required \` jest\` within \` jest\` : 5. required \` jest\` within \` jest\` 1` ] = `
102
+
103
+ const { jest } = require('@jest/globals');
104
+
105
+ jest.mock('some-module', () => {
106
+ jest .requireActual (' some-module' );
107
+ } );
100
108
101
109
110
+ ↓ ↓ ↓ ↓ ↓ ↓
111
+
112
+ const { jest } = require('@jest/globals');
113
+ jest.mock('some-module', () => {
114
+ jest .requireActual (' some-module' );
115
+ } );
116
+
102
117
` ;
103
118
104
- exports [` babel-plugin-jest-hoist imported jest.mock within jest.mock: imported jest.mock within jest.mock 1` ] = `
119
+ exports [` babel-plugin-jest-hoist 6. imported jest.mock within jest.mock: 6. imported jest.mock within jest.mock 1` ] = `
105
120
106
121
import { jest } from '@jest/globals';
107
122
108
123
jest.mock('some-module', () => {
109
124
jest .mock (' some-module' );
110
125
} );
111
126
127
+
112
128
↓ ↓ ↓ ↓ ↓ ↓
113
129
114
130
_getJestObj().mock('some-module', () => {
@@ -121,112 +137,96 @@ function _getJestObj() {
121
137
}
122
138
import { jest } from '@jest/globals';
123
139
124
-
125
140
` ;
126
141
127
- exports [` babel-plugin-jest-hoist imported jest.requireActual in jest.mock: imported jest.requireActual in jest.mock 1` ] = `
128
-
129
- import { jest } from '@jest/globals';
142
+ exports [` babel-plugin-jest-hoist 7. global jest.mock within jest.mock: 7. global jest.mock within jest.mock 1` ] = `
130
143
131
144
jest.mock('some-module', () => {
132
- jest .requireActual (' some-module' );
145
+ jest .mock (' some-module' );
133
146
} );
134
147
135
- jest.requireActual('some-module');
136
148
137
149
↓ ↓ ↓ ↓ ↓ ↓
138
150
139
151
_getJestObj().mock('some-module', () => {
140
- _getJestObj ().requireActual (' some-module' );
152
+ _getJestObj ().mock (' some-module' );
141
153
} );
142
154
function _getJestObj() {
143
155
const {jest } = require (' @jest/globals' );
144
156
_getJestObj = () => jest ;
145
157
return jest ;
146
158
}
147
- import { jest } from '@jest/globals';
148
- jest.requireActual('some-module');
149
-
150
159
151
160
` ;
152
161
153
- exports [` babel-plugin-jest-hoist required \` jest\` within \` jest\` : required \` jest\` within \` jest\` 1` ] = `
162
+ exports [` babel-plugin-jest-hoist 8. imported jest.requireActual in jest.mock: 8. imported jest.requireActual in jest.mock 1` ] = `
154
163
155
- const { jest } = require('@jest/globals');
156
-
157
- jest.mock('some-module', () => {
158
- jest .requireActual (' some-module' );
159
- } );
160
-
161
- ↓ ↓ ↓ ↓ ↓ ↓
164
+ import { jest } from '@jest/globals';
162
165
163
- const { jest } = require('@jest/globals');
164
166
jest.mock('some-module', () => {
165
167
jest .requireActual (' some-module' );
166
168
} );
167
169
170
+ jest.requireActual('some-module');
168
171
169
- ` ;
170
-
171
- exports [` babel-plugin-jest-hoist top level mocking: top level mocking 1` ] = `
172
-
173
- require('x');
174
-
175
- jest.enableAutomock();
176
- jest.disableAutomock();
177
172
178
173
↓ ↓ ↓ ↓ ↓ ↓
179
174
180
- _getJestObj().enableAutomock();
181
- _getJestObj().disableAutomock();
175
+ _getJestObj().mock('some-module', () => {
176
+ _getJestObj ().requireActual (' some-module' );
177
+ } );
182
178
function _getJestObj() {
183
179
const {jest } = require (' @jest/globals' );
184
180
_getJestObj = () => jest ;
185
181
return jest ;
186
182
}
187
- require('x') ;
188
-
183
+ import { jest } from '@jest/globals' ;
184
+ jest.requireActual('some-module');
189
185
190
186
` ;
191
187
192
- exports [` babel-plugin-jest-hoist within a block with no siblings: within a block with no siblings 1` ] = `
188
+ exports [` babel-plugin-jest-hoist 9. global jest.requireActual in jest.mock: 9. global jest.requireActual in jest.mock 1` ] = `
193
189
194
- beforeEach( () => {
195
- jest .mock ( ' someNode ' );
190
+ jest.mock('some-module', () => {
191
+ jest .requireActual ( ' some-module ' );
196
192
} );
197
193
194
+ jest.requireActual('some-module');
195
+
196
+
198
197
↓ ↓ ↓ ↓ ↓ ↓
199
198
199
+ _getJestObj().mock('some-module', () => {
200
+ _getJestObj ().requireActual (' some-module' );
201
+ } );
200
202
function _getJestObj() {
201
203
const {jest } = require (' @jest/globals' );
202
204
_getJestObj = () => jest ;
203
205
return jest ;
204
206
}
205
- beforeEach(() => {
206
- _getJestObj ().mock (' someNode' );
207
- } );
208
-
207
+ jest.requireActual('some-module');
209
208
210
209
` ;
211
210
212
- exports [` babel-plugin-jest-hoist within a block: within a block 1` ] = `
211
+ exports [` babel-plugin-jest-hoist 10. TS typeof usage in jest.mock: 10. TS typeof usage in jest.mock 1` ] = `
213
212
214
- beforeEach(() => {
215
- require (' x' );
216
- jest .mock (' someNode' );
213
+ jest.mock('some-module', () => {
214
+ const actual = jest .requireActual (' some-module' );
215
+
216
+ return jest .fn <typeof actual .method >();
217
217
} );
218
218
219
+
219
220
↓ ↓ ↓ ↓ ↓ ↓
220
221
222
+ _getJestObj().mock('some-module', () => {
223
+ const actual = jest .requireActual (' some-module' );
224
+ return jest .fn ();
225
+ } );
221
226
function _getJestObj() {
222
227
const {jest } = require (' @jest/globals' );
223
228
_getJestObj = () => jest ;
224
229
return jest ;
225
230
}
226
- beforeEach(() => {
227
- _getJestObj ().mock (' someNode' );
228
- require (' x' );
229
- } );
230
-
231
231
232
232
` ;
0 commit comments